MCPcopy Create free account
hub / github.com/github/gh-aw / TestFormatActionCacheKey

Function TestFormatActionCacheKey

pkg/workflow/action_pins_test.go:1245–1287  ·  view source on GitHub ↗

TestFormatActionCacheKey tests the formatActionCacheKey helper function

(t *testing.T)

Source from the content-addressed store, hash-verified

1243
1244// TestFormatActionCacheKey tests the formatActionCacheKey helper function
1245func TestFormatActionCacheKey(t *testing.T) {
1246 tests := []struct {
1247 name string
1248 repo string
1249 version string
1250 expected string
1251 }{
1252 {
1253 name: "standard cache key",
1254 repo: "actions/checkout",
1255 version: "v4",
1256 expected: "actions/checkout@v4",
1257 },
1258 {
1259 name: "cache key with precise version",
1260 repo: "actions/setup-node",
1261 version: "v20.10.0",
1262 expected: "actions/setup-node@v20.10.0",
1263 },
1264 {
1265 name: "cache key with simple version",
1266 repo: "x/y",
1267 version: "v1",
1268 expected: "x/y@v1",
1269 },
1270 {
1271 name: "cache key with SHA",
1272 repo: "actions/upload-artifact",
1273 version: "abc1234567890123456789012345678901234567",
1274 expected: "actions/upload-artifact@abc1234567890123456789012345678901234567",
1275 },
1276 }
1277
1278 for _, tt := range tests {
1279 t.Run(tt.name, func(t *testing.T) {
1280 result := formatActionCacheKey(tt.repo, tt.version)
1281 if result != tt.expected {
1282 t.Errorf("formatActionCacheKey(%q, %q) = %q, want %q",
1283 tt.repo, tt.version, result, tt.expected)
1284 }
1285 })
1286 }
1287}
1288
1289// TestMapToStepWithActionPinning tests the integration of MapToStep and applyActionPinToTypedStep
1290// This verifies the migration pattern used in compiler_jobs.go, safe_jobs.go, and custom_engine.go

Callers

nothing calls this directly

Calls 3

formatActionCacheKeyFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected