Skip to content

Commit c65b211

Browse files
test(deploy): add mig-068 scale-to-zero columns to redeploy sqlmock rows
FindActiveDeploymentByTeamEnvName / ByAppID now scan 33 columns after mig 068 added last_activity_at, scaled_to_zero, always_on to deployments. The redeploy in-place mock rows still provided 30, so scanDeployment failed with "expected 30 destination arguments in Scan, not 33" and reded TestDeployNew_Redeploy_WrongTeam_DefenceInDepth and TestDeployNew_Redeploy_UpdateStatusError_StillAccepts. Extend deploymentColumnsList + every AddRow tuple in this file (7 mock rows across the ByTeamEnvName and ByAppID query paths) with the 3 new columns in the model's Scan order: sql.NullTime{}, false, false. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 568b43e commit c65b211

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/handlers/deploy_redeploy_inplace_mock_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ var deploymentColumnsList = []string{
7777
"expires_at", "ttl_policy", "reminders_sent", "last_reminder_at",
7878
"source", "image_ref", "registry_creds_enc",
7979
"git_url", "git_ref", "git_token_enc",
80+
"last_activity_at", "scaled_to_zero", "always_on",
8081
}
8182

8283
// redeployMockApp wires a minimal Fiber app that drives DeployHandler.New
@@ -256,6 +257,7 @@ func TestDeployNew_Redeploy_WrongTeam_DefenceInDepth(t *testing.T) {
256257
sql.NullTime{}, "permanent", 0, sql.NullTime{}, // ttl_*
257258
"tarball", "", "", // source, image_ref, registry_creds_enc (mig 064)
258259
"", "", "", // git_url, git_ref, git_token_enc (mig 065)
260+
sql.NullTime{}, false, false, // last_activity_at, scaled_to_zero, always_on (mig 068)
259261
))
260262

261263
body, ct := multipartRedeployMockBody(t, map[string]string{
@@ -328,6 +330,7 @@ func TestDeployNew_Redeploy_UpdateStatusError_StillAccepts(t *testing.T) {
328330
sql.NullTime{}, "permanent", 0, sql.NullTime{},
329331
"tarball", "", "", // source, image_ref, registry_creds_enc (mig 064)
330332
"", "", "", // git_url, git_ref, git_token_enc (mig 065)
333+
sql.NullTime{}, false, false, // last_activity_at, scaled_to_zero, always_on (mig 068)
331334
))
332335

333336
// MarkDeploymentBuilding (guarded CAS) → driver error. The handler must
@@ -420,6 +423,7 @@ func TestDeployNew_Redeploy_EmptyProviderID_Returns409(t *testing.T) {
420423
sql.NullTime{}, "permanent", 0, sql.NullTime{},
421424
"tarball", "", "", // source, image_ref, registry_creds_enc (mig 064)
422425
"", "", "", // git_url, git_ref, git_token_enc (mig 065)
426+
sql.NullTime{}, false, false, // last_activity_at, scaled_to_zero, always_on (mig 068)
423427
))
424428

425429
body, ct := multipartRedeployMockBody(t, map[string]string{
@@ -486,6 +490,7 @@ func TestDeployNew_Redeploy_CASMiss_Returns409(t *testing.T) {
486490
sql.NullTime{}, "permanent", 0, sql.NullTime{},
487491
"tarball", "", "", // source, image_ref, registry_creds_enc (mig 064)
488492
"", "", "", // git_url, git_ref, git_token_enc (mig 065)
493+
sql.NullTime{}, false, false, // last_activity_at, scaled_to_zero, always_on (mig 068)
489494
))
490495

491496
// Guarded CAS matches 0 rows — the reaper won the race. Handler 409s.
@@ -597,6 +602,7 @@ func TestDeployRedeploy_ByID_CASMiss_Returns409(t *testing.T) {
597602
sql.NullTime{}, "permanent", 0, sql.NullTime{},
598603
"tarball", "", "",
599604
"", "", "",
605+
sql.NullTime{}, false, false,
600606
))
601607

602608
// Guarded CAS matches 0 rows — the reaper won the race after the read.
@@ -652,6 +658,7 @@ func TestDeployRedeploy_ByID_CASSuccess_Returns202(t *testing.T) {
652658
sql.NullString{}, sql.NullString{}, "unset", 0,
653659
sql.NullTime{}, "permanent", 0, sql.NullTime{},
654660
"tarball", "", "", "", "", "",
661+
sql.NullTime{}, false, false,
655662
))
656663

657664
mock.ExpectExec(`UPDATE deployments\s+SET status = 'building', error_message = NULL, updated_at = now\(\)\s+WHERE id = \$1 AND status IN`).
@@ -702,6 +709,7 @@ func TestDeployRedeploy_ByID_CASDriverError_StillAccepts(t *testing.T) {
702709
sql.NullString{}, sql.NullString{}, "unset", 0,
703710
sql.NullTime{}, "permanent", 0, sql.NullTime{},
704711
"tarball", "", "", "", "", "",
712+
sql.NullTime{}, false, false,
705713
))
706714

707715
// Guarded CAS → driver error (non-determinate). Handler logs + continues.

0 commit comments

Comments
 (0)