Skip to content
Merged
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
55 changes: 0 additions & 55 deletions pkg/workflow/action_pins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,61 +533,6 @@ func TestApplyActionPinToTypedStep_Immutability(t *testing.T) {
}
}

// TestGetActionPinSemverPreference verifies that when multiple versions exist for the same repo,
// the latest version by semver is returned
func TestGetActionPinSemverPreference(t *testing.T) {
tests := []struct {
name string
repo string
expectedVersion string
}{
{
name: "setup-go prefers v6.2.0 over v6",
repo: "actions/setup-go",
expectedVersion: "v6.2.0",
},
{
name: "setup-node prefers v6.2.0 over v6",
repo: "actions/setup-node",
expectedVersion: "v6.2.0",
},
{
name: "upload-artifact prefers v6.0.0 over v5 and v4",
repo: "actions/upload-artifact",
expectedVersion: "v6.0.0",
},
{
name: "setup-python prefers v5.6.0 over v5",
repo: "actions/setup-python",
expectedVersion: "v5.6.0",
},
{
name: "cache prefers v4.3.0 over v4",
repo: "actions/cache",
expectedVersion: "v4.3.0",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test GetActionPin
result := GetActionPin(tt.repo)
if !strings.Contains(result, "# "+tt.expectedVersion) {
t.Errorf("GetActionPin(%s) = %s, expected version %s", tt.repo, result, tt.expectedVersion)
}

// Test GetActionPinByRepo
pin, exists := GetActionPinByRepo(tt.repo)
if !exists {
t.Fatalf("GetActionPinByRepo(%s) returned false, expected true", tt.repo)
}
if pin.Version != tt.expectedVersion {
t.Errorf("GetActionPinByRepo(%s).Version = %s, expected %s", tt.repo, pin.Version, tt.expectedVersion)
}
})
}
}

// TestGetActionPinWithData_SemverPreference tests that GetActionPinWithData
// resolves actions using the exact version tag specified, and only falls back
// to compatible versions when the exact tag doesn't exist in hardcoded pins
Expand Down