From 04a5fddee622221fe4676a281482b0db5f2b05e3 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Wed, 30 Aug 2023 10:45:10 +0800 Subject: [PATCH] fix: reset prompt defaults to true for CI environments --- internal/db/reset/reset.go | 2 +- internal/db/reset/reset_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/db/reset/reset.go b/internal/db/reset/reset.go index 8c74d8559..91f028737 100644 --- a/internal/db/reset/reset.go +++ b/internal/db/reset/reset.go @@ -49,7 +49,7 @@ func Run(ctx context.Context, version string, config pgconn.Config, fsys afero.F } } if len(config.Password) > 0 { - if shouldReset := utils.PromptYesNo("Confirm resetting the remote database?", false, os.Stdin); !shouldReset { + if shouldReset := utils.PromptYesNo("Confirm resetting the remote database?", true, os.Stdin); !shouldReset { return context.Canceled } return resetRemote(ctx, version, config, fsys, options...) diff --git a/internal/db/reset/reset_test.go b/internal/db/reset/reset_test.go index 513b5a5f1..5a8edb717 100644 --- a/internal/db/reset/reset_test.go +++ b/internal/db/reset/reset_test.go @@ -30,7 +30,7 @@ func TestResetCommand(t *testing.T) { // Run test err := Run(context.Background(), "", pgconn.Config{Password: "postgres"}, fsys) // Check error - assert.ErrorIs(t, err, context.Canceled) + assert.ErrorContains(t, err, "invalid port (outside range)") }) t.Run("throws error on missing config", func(t *testing.T) {