Skip to content

Commit

Permalink
try gha postgres container
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Nov 12, 2024
1 parent 1569963 commit 3cd0ee7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions vault/resource_database_secret_backend_static_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,18 @@ CREATE ROLE "{{name}}" WITH
PASSWORD '{{password}}';
`

cleanup, pgxURL := testutil.PrepareTestContainerSelfManaged(t)
defer cleanup()
// cleanup, pgxURL := testutil.PrepareTestContainerSelfManaged(t)
// defer cleanup()

fmt.Printf("\npgxURL.Host: %s\n", pgxURL.Host)
connURL := fmt.Sprintf("postgresql://{{username}}:{{password}}@%s/postgres?sslmode=disable", pgxURL.Host)
// fmt.Printf("\npgxURL.Host: %s\n", pgxURL.Host)
// connURL := fmt.Sprintf("postgresql://{{username}}:{{password}}@%s/postgres?sslmode=disable", pgxURL.Host)
connURLRoot := testutil.SkipTestEnvUnset(t, "POSTGRES_URL")[0]
connURL := fmt.Sprintf("postgres://{{username}}:{{password}}@postgres:5432/database?sslmode=disable")
// postgres://postgres:secret@postgres:5432/database?sslmode=disable

// create static database user
testutil.CreateTestPGUser(t, pgxURL.String(), username, "testpassword", testRoleStaticCreate)
testutil.GetTestPGUser(t, pgxURL.String(), username, "testpassword", testRoleStaticCreate)
testutil.CreateTestPGUser(t, connURLRoot, username, "testpassword", testRoleStaticCreate)
testutil.GetTestPGUser(t, connURLRoot, username, "testpassword", testRoleStaticCreate)

resource.Test(t, resource.TestCase{
ProviderFactories: providerFactories,
Expand Down Expand Up @@ -206,7 +209,7 @@ CREATE ROLE "{{name}}" WITH
},
},
})
testutil.GetTestPGUser(t, pgxURL.String(), username, "testpassword", testRoleStaticCreate)
testutil.GetTestPGUser(t, connURLRoot, username, "testpassword", testRoleStaticCreate)
}

func testAccDatabaseSecretBackendStaticRoleCheckDestroy(s *terraform.State) error {
Expand Down

0 comments on commit 3cd0ee7

Please sign in to comment.