Skip to content

Commit

Permalink
chore: test config declaration order
Browse files Browse the repository at this point in the history
  • Loading branch information
avallete committed Sep 9, 2024
1 parent 4e3898e commit 5e29d4c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/db/reset/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ func TestRestartDatabase(t *testing.T) {
utils.GotrueId = "test-auth"
utils.RealtimeId = "test-realtime"
utils.PoolerId = "test-pooler"
utils.Config.Storage.Enabled = true
utils.Config.Auth.Enabled = true
utils.Config.Realtime.Enabled = true
for _, container := range []string{utils.StorageId, utils.GotrueId, utils.RealtimeId} {
gock.New(utils.Docker.DaemonHost()).
Post("/v" + utils.Docker.ClientVersion() + "/containers/" + container + "/restart").
Expand Down Expand Up @@ -323,10 +326,6 @@ func TestRestartDatabase(t *testing.T) {
})
t.Run("restarts only enabled services", func(t *testing.T) {
utils.DbId = "test-reset"
utils.Config.Storage.Enabled = false
utils.Config.Auth.Enabled = true
utils.Config.Realtime.Enabled = true
utils.Config.Db.Pooler.Enabled = false
// Setup mock docker
require.NoError(t, apitest.MockDocker(utils.Docker))
defer gock.OffAll()
Expand All @@ -348,11 +347,20 @@ func TestRestartDatabase(t *testing.T) {
utils.PoolerId = "test-pooler"
utils.GotrueId = "test-auth"
utils.RealtimeId = "test-realtime"
utils.Config.Auth.Enabled = true
utils.Config.Realtime.Enabled = true
utils.Config.Db.Pooler.Enabled = false
utils.Config.Storage.Enabled = false
for _, container := range []string{utils.GotrueId, utils.RealtimeId} {
gock.New(utils.Docker.DaemonHost()).
Post("/v" + utils.Docker.ClientVersion() + "/containers/" + container + "/restart").
Reply(http.StatusOK)
}
for _, container := range []string{utils.StorageId, utils.PoolerId} {
gock.New(utils.Docker.DaemonHost()).
Post("/v" + utils.Docker.ClientVersion() + "/containers/" + container + "/restart").
Reply(http.StatusServiceUnavailable)
}
// Run test
err := RestartDatabase(context.Background(), io.Discard)
// Check error
Expand Down

0 comments on commit 5e29d4c

Please sign in to comment.