Skip to content

Commit

Permalink
chore: apply pr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
avallete committed Nov 29, 2024
1 parent a940423 commit 189f294
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion internal/config/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Run(ctx context.Context, ref string, fsys afero.Fs) error {
if err := utils.LoadConfigFS(fsys); err != nil {
return err
}
client := config.NewConfigUpdater(*utils.GetSupabase(), false)
client := config.NewConfigUpdater(*utils.GetSupabase())
remote, err := utils.Config.GetRemoteByProjectRef(ref)
if err != nil {
// Use base config when no remote is declared
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type ConfigUpdater struct {
skipSecrets bool
}

func NewConfigUpdater(client v1API.ClientWithResponses, skipSecrets bool) ConfigUpdater {
return ConfigUpdater{client: client, skipSecrets: skipSecrets}
func NewConfigUpdater(client v1API.ClientWithResponses) ConfigUpdater {
return ConfigUpdater{client: client, skipSecrets: false}
}

func (u *ConfigUpdater) UpdateRemoteConfig(ctx context.Context, remote baseConfig, filter ...func(string) bool) error {
Expand Down
27 changes: 14 additions & 13 deletions pkg/config/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestUpdateApi(t *testing.T) {
require.NoError(t, err)

t.Run("updates remote config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand Down Expand Up @@ -46,7 +46,7 @@ func TestUpdateApi(t *testing.T) {
})

t.Run("skips update if no diff", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -71,7 +71,7 @@ func TestUpdateDbConfig(t *testing.T) {
require.NoError(t, err)

t.Run("updates remote DB config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -96,7 +96,7 @@ func TestUpdateDbConfig(t *testing.T) {
})

t.Run("skips update if no diff in DB config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -123,7 +123,7 @@ func TestUpdateExperimentalConfig(t *testing.T) {
require.NoError(t, err)

t.Run("enables webhooks", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -142,7 +142,7 @@ func TestUpdateExperimentalConfig(t *testing.T) {
})

t.Run("skips update if webhooks not enabled", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Run test
err := updater.UpdateExperimentalConfig(context.Background(), "test-project", experimental{
Webhooks: &webhooks{
Expand All @@ -154,13 +154,14 @@ func TestUpdateExperimentalConfig(t *testing.T) {
assert.True(t, gock.IsDone())
})
}

func TestUpdateAuthConfig(t *testing.T) {
server := "http://localhost"
client, err := v1API.NewClientWithResponses(server)
require.NoError(t, err)

t.Run("updates remote Auth config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -180,7 +181,7 @@ func TestUpdateAuthConfig(t *testing.T) {
})

t.Run("skips update if no diff in Auth config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -200,7 +201,7 @@ func TestUpdateAuthConfig(t *testing.T) {
})

t.Run("skips update if disabled locally", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Run test
err := updater.UpdateAuthConfig(context.Background(), "test-project", auth{})
// Check result
Expand All @@ -214,7 +215,7 @@ func TestUpdateStorageConfig(t *testing.T) {
require.NoError(t, err)

t.Run("updates remote Storage config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -239,7 +240,7 @@ func TestUpdateStorageConfig(t *testing.T) {
})

t.Run("skips update if no diff in Storage config", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
gock.New(server).
Expand All @@ -254,7 +255,7 @@ func TestUpdateStorageConfig(t *testing.T) {
})

t.Run("skips update if disabled locally", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Run test
err := updater.UpdateStorageConfig(context.Background(), "test-project", storage{})
// Check result
Expand All @@ -268,7 +269,7 @@ func TestUpdateRemoteConfig(t *testing.T) {
require.NoError(t, err)

t.Run("updates all configs", func(t *testing.T) {
updater := NewConfigUpdater(*client, false)
updater := NewConfigUpdater(*client)
// Setup mock server
defer gock.Off()
// API config
Expand Down

0 comments on commit 189f294

Please sign in to comment.