Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: preserve task run cancellation error (#20319)
p0ny16864da53446
diff --git a/backend/runner/taskrun/database_migrate_executor.go b/backend/runner/taskrun/database_migrate_executor.goindex a228b5dda9..f833b618df 100644--- a/backend/runner/taskrun/database_migrate_executor.go+++ b/backend/runner/taskrun/database_migrate_executor.go@@ -374,7 +374,7 @@ func executeGhostMigration(ctx context.Context, driverCtx context.Context, taskopts.LogGhostMigrationEnd("")return nilcase <-driverCtx.Done():- err := errors.New("task canceled")+ err := errors.Wrap(driverCtx.Err(), "task canceled")opts.LogGhostMigrationEnd(err.Error())abortCtx, cancel := context.WithTimeout(context.Background(), time.Second)defer cancel()diff --git a/backend/runner/taskrun/database_migrate_executor_test.go b/backend/runner/taskrun/database_migrate_executor_test.goindex e71713f694..cb1c65b12d 100644--- a/backend/runner/taskrun/database_migrate_executor_test.go+++ b/backend/runner/taskrun/database_migrate_executor_test.go@@ -1,13 +1,25 @@package taskrunimport (+ "context""testing"+ "github.com/pkg/errors""github.com/stretchr/testify/require"storepb "github.com/bytebase/bytebase/backend/generated-go/store")+func TestWrappedContextCanceledMatchesErrorsIs(t *testing.T) {+ driverCtx, cancel := context.WithCancel(context.Background())+ cancel()++ err := errors.Wrap(driverCtx.Err(), "task canceled")+ require.Error(t, err)+ require.ErrorIs(t, err, context.Canceled)+ require.Contains(t, err.Error(), "task canceled")+}+func TestGetPrependStatements(t *testing.T) {tests := []struct {name string