Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/cli/codemod_safe_output_merge_pr_constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestSafeOutputMergePRConstraintsCodemod(t *testing.T) {
t.Parallel()
codemod := getSafeOutputMergePRConstraintsCodemod()

t.Run("renames allowed-labels to required-labels, leaves allowed-branches unchanged", func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/codemod_safe_output_require_title_prefix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestSafeOutputRequireTitlePrefixCodemod(t *testing.T) {
t.Parallel()
codemod := getSafeOutputRequireTitlePrefixCodemod()

t.Run("renames close and push constraint keys", func(t *testing.T) {
Expand Down
10 changes: 10 additions & 0 deletions pkg/cli/codemod_sandbox_agent_false_removal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetSandboxAgentFalseRemovalCodemod(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

assert.Equal(t, "sandbox-agent-false-removal", codemod.ID)
Expand All @@ -20,6 +21,7 @@ func TestGetSandboxAgentFalseRemovalCodemod(t *testing.T) {
}

func TestSandboxAgentFalseRemoval_RemovesAgentFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down Expand Up @@ -52,6 +54,7 @@ permissions:
}

func TestSandboxAgentFalseRemoval_PreservesOtherSandboxKeys(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down Expand Up @@ -84,6 +87,7 @@ sandbox:
}

func TestSandboxAgentFalseRemoval_NoSandboxKey(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand All @@ -109,6 +113,7 @@ permissions:
}

func TestSandboxAgentFalseRemoval_AgentNotFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand All @@ -134,6 +139,7 @@ sandbox:
}

func TestSandboxAgentFalseRemoval_AgentObject(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down Expand Up @@ -162,6 +168,7 @@ sandbox:
}

func TestSandboxAgentFalseRemoval_AgentTrue(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand All @@ -187,6 +194,7 @@ sandbox:
}

func TestSandboxAgentFalseRemoval_SkipsWhenStrictFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down Expand Up @@ -214,6 +222,7 @@ sandbox:
}

func TestSandboxAgentFalseRemoval_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down Expand Up @@ -242,6 +251,7 @@ This workflow was using the nosandbox escape hatch.`
}

func TestSandboxAgentFalseRemoval_NoAgentKey(t *testing.T) {
t.Parallel()
codemod := getSandboxAgentFalseRemovalCodemod()

content := `---
Expand Down
8 changes: 8 additions & 0 deletions pkg/cli/codemod_sandbox_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetSandboxFalseToAgentFalseCodemod(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

assert.Equal(t, "sandbox-false-to-agent-false", codemod.ID)
Expand All @@ -20,6 +21,7 @@ func TestGetSandboxFalseToAgentFalseCodemod(t *testing.T) {
}

func TestSandboxFalseToAgentFalseCodemod_ConvertsBooleanFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand Down Expand Up @@ -49,6 +51,7 @@ permissions:
}

func TestSandboxFalseToAgentFalseCodemod_PreservesIndentation(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand Down Expand Up @@ -79,6 +82,7 @@ permissions:
}

func TestSandboxFalseToAgentFalseCodemod_NoSandboxField(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand All @@ -104,6 +108,7 @@ permissions:
}

func TestSandboxFalseToAgentFalseCodemod_SandboxTrue(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand All @@ -126,6 +131,7 @@ sandbox: true
}

func TestSandboxFalseToAgentFalseCodemod_SandboxObject(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand All @@ -151,6 +157,7 @@ sandbox:
}

func TestSandboxFalseToAgentFalseCodemod_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand All @@ -176,6 +183,7 @@ This workflow runs without a sandbox.`
}

func TestSandboxFalseToAgentFalseCodemod_WithStrictFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxFalseToAgentFalseCodemod()

content := `---
Expand Down
16 changes: 16 additions & 0 deletions pkg/cli/codemod_sandbox_mcp_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// ----- getSandboxMCPContainerRemovalCodemod tests -----

func TestGetSandboxMCPContainerRemovalCodemod(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

assert.Equal(t, "sandbox-mcp-container-removal", codemod.ID)
Expand All @@ -22,6 +23,7 @@ func TestGetSandboxMCPContainerRemovalCodemod(t *testing.T) {
}

func TestSandboxMCPContainerRemoval_RemovesContainer(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand Down Expand Up @@ -59,6 +61,7 @@ permissions:
}

func TestSandboxMCPContainerRemoval_NoSandboxKey(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand All @@ -84,6 +87,7 @@ permissions:
}

func TestSandboxMCPContainerRemoval_NoMCPKey(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand All @@ -109,6 +113,7 @@ sandbox:
}

func TestSandboxMCPContainerRemoval_NoContainerField(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand Down Expand Up @@ -137,6 +142,7 @@ sandbox:
}

func TestSandboxMCPContainerRemoval_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand Down Expand Up @@ -171,6 +177,7 @@ This is a test workflow.`
// ----- getSandboxMCPVersionRemovalCodemod tests -----

func TestGetSandboxMCPVersionRemovalCodemod(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPVersionRemovalCodemod()

assert.Equal(t, "sandbox-mcp-version-removal", codemod.ID)
Expand All @@ -181,6 +188,7 @@ func TestGetSandboxMCPVersionRemovalCodemod(t *testing.T) {
}

func TestSandboxMCPVersionRemoval_RemovesVersion(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPVersionRemovalCodemod()

content := `---
Expand Down Expand Up @@ -218,6 +226,7 @@ permissions:
}

func TestSandboxMCPVersionRemoval_NoVersionField(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPVersionRemovalCodemod()

content := `---
Expand Down Expand Up @@ -246,6 +255,7 @@ sandbox:
}

func TestSandboxMCPVersionRemoval_NoSandboxKey(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPVersionRemovalCodemod()

content := `---
Expand All @@ -266,6 +276,7 @@ on: workflow_dispatch
}

func TestSandboxMCPContainerRemoval_SkipsWhenStrictFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPContainerRemovalCodemod()

content := `---
Expand Down Expand Up @@ -298,6 +309,7 @@ sandbox:
}

func TestSandboxMCPVersionRemoval_SkipsWhenStrictFalse(t *testing.T) {
t.Parallel()
codemod := getSandboxMCPVersionRemovalCodemod()

content := `---
Expand Down Expand Up @@ -330,6 +342,7 @@ sandbox:
}

func TestSandboxMCPVersionRemoval_BothContainerAndVersion(t *testing.T) {
t.Parallel()
// Verify that version removal does not affect the container key.
codemod := getSandboxMCPVersionRemovalCodemod()

Expand Down Expand Up @@ -365,6 +378,7 @@ sandbox:
}

func TestSandboxMCPContainerRemoval_RemovesEmptySandboxGrandparent(t *testing.T) {
t.Parallel()
// When container: is the only field under mcp:, and mcp: is the only field
// under sandbox:, the codemod must remove all three levels to avoid a
// dangling "sandbox:" key that YAML parses as null.
Expand Down Expand Up @@ -404,6 +418,7 @@ permissions:
}

func TestSandboxMCPVersionRemoval_RemovesEmptySandboxGrandparent(t *testing.T) {
t.Parallel()
// When version: is the only field under mcp:, and mcp: is the only field
// under sandbox:, the codemod must remove all three levels to avoid a
// dangling "sandbox:" key that YAML parses as null.
Expand Down Expand Up @@ -443,6 +458,7 @@ permissions:
}

func TestSandboxMCPContainerRemoval_KeepsSandboxWhenOtherChildrenRemain(t *testing.T) {
t.Parallel()
// When sandbox: has other children besides mcp:, it must be preserved even
// after mcp: becomes empty and is removed.
codemod := getSandboxMCPContainerRemovalCodemod()
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/codemod_sandbox_runtime_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetSandboxRuntimeProfileCodemod(t *testing.T) {
t.Parallel()
codemod := getSandboxRuntimeProfileCodemod()

assert.Equal(t, "sandbox-runtime-profiles", codemod.ID)
Expand All @@ -20,6 +21,7 @@ func TestGetSandboxRuntimeProfileCodemod(t *testing.T) {
}

func TestSandboxRuntimeProfileCodemod_Migrations(t *testing.T) {
t.Parallel()
codemod := getSandboxRuntimeProfileCodemod()

tests := []struct {
Expand Down Expand Up @@ -210,6 +212,7 @@ sandbox:
// only key under sandbox.agent also removes the now-empty parent mappings, which would
// otherwise fail schema validation as a null value.
func TestSandboxRuntimeProfileCodemod_RemovesEmptySandboxBlock(t *testing.T) {
t.Parallel()
codemod := getSandboxRuntimeProfileCodemod()

content := `---
Expand Down
11 changes: 11 additions & 0 deletions pkg/cli/codemod_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetScheduleAtToAroundCodemod(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

assert.Equal(t, "schedule-at-to-around-migration", codemod.ID)
Expand All @@ -20,6 +21,7 @@ func TestGetScheduleAtToAroundCodemod(t *testing.T) {
}

func TestScheduleCodemod_DailyAt(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down Expand Up @@ -47,6 +49,7 @@ on:
}

func TestScheduleCodemod_WeeklyOnAt(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down Expand Up @@ -74,6 +77,7 @@ on:
}

func TestScheduleCodemod_MonthlyOn(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down Expand Up @@ -101,6 +105,7 @@ on:
}

func TestScheduleCodemod_MonthlyOnAt(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down Expand Up @@ -128,6 +133,7 @@ on:
}

func TestScheduleCodemod_DailyAround_NoChange(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand All @@ -154,6 +160,7 @@ on:
}

func TestScheduleCodemod_StandardCron_NoChange(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand All @@ -180,6 +187,7 @@ on:
}

func TestScheduleCodemod_PreservesIndentation(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand All @@ -206,6 +214,7 @@ on:
}

func TestScheduleCodemod_MultipleSchedules(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down Expand Up @@ -235,6 +244,7 @@ on:
}

func TestScheduleCodemod_ScheduleField(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand All @@ -261,6 +271,7 @@ on:
}

func TestScheduleCodemod_PreservesMarkdown(t *testing.T) {
t.Parallel()
codemod := getScheduleAtToAroundCodemod()

content := `---
Expand Down
Loading
Loading