Skip more pg backend acceptance tests

This commit is contained in:
Mars Hall 2019-02-26 16:46:06 -08:00
parent 3c68b857be
commit 6d9e2048f4
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package pg
// 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 (
"database/sql"
@ -14,7 +14,10 @@ import (
_ "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) {
skip := os.Getenv("TF_ACC") == ""
if skip {

View File

@ -1,5 +1,8 @@
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 (
"database/sql"
"fmt"
@ -15,6 +18,7 @@ func TestRemoteClient_impl(t *testing.T) {
}
func TestRemoteClient(t *testing.T) {
testACC(t)
connStr := getDatabaseUrl()
schemaName := fmt.Sprintf("terraform_%s", t.Name())
dbCleaner, err := sql.Open("postgres", connStr)
@ -42,6 +46,7 @@ func TestRemoteClient(t *testing.T) {
}
func TestRemoteLocks(t *testing.T) {
testACC(t)
connStr := getDatabaseUrl()
schemaName := fmt.Sprintf("terraform_%s", t.Name())
dbCleaner, err := sql.Open("postgres", connStr)