Skip to content

Commit

Permalink
Skip more pg backend acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mars committed Feb 27, 2019
1 parent 3c68b85 commit 887506b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/remote-state/pg/backend_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions backend/remote-state/pg/client_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 887506b

Please sign in to comment.