diff options
Diffstat (limited to '')
-rw-r--r-- | cmd/tfstated/main_test.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/cmd/tfstated/main_test.go b/cmd/tfstated/main_test.go index 3ad1d7e..82b7736 100644 --- a/cmd/tfstated/main_test.go +++ b/cmd/tfstated/main_test.go @@ -19,7 +19,7 @@ var baseURI = url.URL{ Scheme: "http", } var db *database.DB -var password string +var adminPassword string func TestMain(m *testing.M) { ctx := context.Background() @@ -46,6 +46,9 @@ func TestMain(m *testing.M) { } } + database.AdvertiseAdminPassword = func(password string) { + adminPassword = password + } go run( ctx, &config, @@ -59,13 +62,6 @@ func TestMain(m *testing.M) { os.Exit(1) } - admin, err := db.LoadAccountByUsername("admin") - if err != nil { - fmt.Fprintf(os.Stderr, "%+v\n", err) - os.Exit(1) - } - password = admin.Password - ret := m.Run() cancel() @@ -88,7 +84,7 @@ func runHTTPRequest(method string, auth bool, uriRef *url.URL, body io.Reader, t return } if auth { - req.SetBasicAuth("admin", password) + req.SetBasicAuth("admin", adminPassword) } resp, err := client.Do(req) if err != nil { |