Skip more pg backend acceptance tests
This commit is contained in:
parent
3c68b857be
commit
6d9e2048f4
|
@ -1,7 +1,7 @@
|
||||||
package pg
|
package pg
|
||||||
|
|
||||||
// Create the test database: createdb terraform_backend_pg_test
|
// Create the test database: createdb terraform_backend_pg_test
|
||||||
// TF_ACC=1 make test TEST=./backend/remote-state/pg TESTARGS='-v -run ^TestBackend'
|
// TF_ACC=1 GO111MODULE=on go test -v -mod=vendor -timeout=2m -parallel=4 github.com/hashicorp/terraform/backend/remote-state/pg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
@ -14,7 +14,10 @@ import (
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
// verify that we are doing ACC tests or the Postgres tests specifically
|
// Function to skip a test unless in ACCeptance test mode.
|
||||||
|
//
|
||||||
|
// A running Postgres server identified by env variable
|
||||||
|
// DATABASE_URL is required for acceptance tests.
|
||||||
func testACC(t *testing.T) {
|
func testACC(t *testing.T) {
|
||||||
skip := os.Getenv("TF_ACC") == ""
|
skip := os.Getenv("TF_ACC") == ""
|
||||||
if skip {
|
if skip {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package pg
|
package pg
|
||||||
|
|
||||||
|
// Create the test database: createdb terraform_backend_pg_test
|
||||||
|
// TF_ACC=1 GO111MODULE=on go test -v -mod=vendor -timeout=2m -parallel=4 github.com/hashicorp/terraform/backend/remote-state/pg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -15,6 +18,7 @@ func TestRemoteClient_impl(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRemoteClient(t *testing.T) {
|
func TestRemoteClient(t *testing.T) {
|
||||||
|
testACC(t)
|
||||||
connStr := getDatabaseUrl()
|
connStr := getDatabaseUrl()
|
||||||
schemaName := fmt.Sprintf("terraform_%s", t.Name())
|
schemaName := fmt.Sprintf("terraform_%s", t.Name())
|
||||||
dbCleaner, err := sql.Open("postgres", connStr)
|
dbCleaner, err := sql.Open("postgres", connStr)
|
||||||
|
@ -42,6 +46,7 @@ func TestRemoteClient(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRemoteLocks(t *testing.T) {
|
func TestRemoteLocks(t *testing.T) {
|
||||||
|
testACC(t)
|
||||||
connStr := getDatabaseUrl()
|
connStr := getDatabaseUrl()
|
||||||
schemaName := fmt.Sprintf("terraform_%s", t.Name())
|
schemaName := fmt.Sprintf("terraform_%s", t.Name())
|
||||||
dbCleaner, err := sql.Open("postgres", connStr)
|
dbCleaner, err := sql.Open("postgres", connStr)
|
||||||
|
|
Loading…
Reference in New Issue