diff --git a/orbit/pkg/update/update_test.go b/orbit/pkg/update/update_test.go index 678feb2d02..9f6c6233a4 100644 --- a/orbit/pkg/update/update_test.go +++ b/orbit/pkg/update/update_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/fleetdm/fleet/v4/orbit/pkg/constant" + "github.com/jinzhu/copier" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -53,7 +54,11 @@ func TestMakeRepoPath(t *testing.T) { t.Run(tt.expected, func(t *testing.T) { t.Parallel() - opt := DefaultOptions + var opt Options + // Must deep copy DefaultOptions, otherwise there is a race condition when modifying the + // opt.Targets map in parallel tests below. + err := copier.CopyWithOption(&opt, DefaultOptions, copier.Option{DeepCopy: true}) + require.NoError(t, err) osqueryd := opt.Targets[tt.name] osqueryd.Platform = tt.platform diff --git a/server/datastore/mysql/migrations/tables/20201011162341_CleanupSoftDeletedColumns.go b/server/datastore/mysql/migrations/tables/20201011162341_CleanupSoftDeletedColumns.go index 36c6c5ad6a..2157c3cc23 100644 --- a/server/datastore/mysql/migrations/tables/20201011162341_CleanupSoftDeletedColumns.go +++ b/server/datastore/mysql/migrations/tables/20201011162341_CleanupSoftDeletedColumns.go @@ -56,7 +56,7 @@ func cleanupSoftDeleteFields(tx *sql.Tx, dbTable string) error { } func addSoftDeleteFields(tx *sql.Tx, dbTable string) error { - addDeletedStmt := fmt.Sprint( + addDeletedStmt := fmt.Sprintf( "ALTER TABLE `%s` "+ "ADD COLUMN `deleted` TINYINT(1) NOT NULL DEFAULT FALSE;", dbTable) @@ -65,7 +65,7 @@ func addSoftDeleteFields(tx *sql.Tx, dbTable string) error { return err } - addDeletedAtStmt := fmt.Sprint( + addDeletedAtStmt := fmt.Sprintf( "ALTER TABLE `%s` "+ "ADD COLUMN `deleted_at` TIMESTAMP NULL DEFAULT NULL;", dbTable)