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

Function TestGetActionPinWithData_SemverPreference

pkg/workflow/action_pins_test.go:577–665  ·  view source on GitHub ↗

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

(t *testing.T)

Source from the content-addressed store, hash-verified

575// resolves actions using the exact version tag specified, and only falls back
576// to compatible versions when the exact tag doesn't exist in hardcoded pins
577func TestGetActionPinWithData_SemverPreference(t *testing.T) {
578 tests := []struct {
579 name string
580 repo string
581 requestedVer string
582 expectedVer string
583 strictMode bool
584 shouldFallback bool // Whether we expect to fall back to highest version
585 }{
586 {
587 name: "fallback for setup-go v6.2.0 resolves to v6.5.0",
588 repo: "actions/setup-go",
589 requestedVer: "v6.2.0",
590 expectedVer: "v6.5.0",
591 strictMode: false,
592 shouldFallback: true,
593 },
594 {
595 name: "fallback for setup-go v6.2.0 from hardcoded pins resolves to v6.5.0",
596 repo: "actions/setup-go",
597 requestedVer: "v6.2.0",
598 expectedVer: "v6.5.0",
599 strictMode: false,
600 shouldFallback: true,
601 },
602 {
603 name: "fallback to highest semver-compatible version for upload-artifact when requesting v4",
604 repo: "actions/upload-artifact",
605 requestedVer: "v4",
606 expectedVer: "v7.0.1",
607 strictMode: false,
608 shouldFallback: true,
609 // Note: When requesting v4 without dynamic resolution, the system uses v4.6.2's SHA
610 // (the highest v4.x.x version from hardcoded pins), but shows v4 in the comment
611 // to preserve the user's intent.
612 },
613 {
614 name: "fallback to highest semver-compatible version for upload-artifact when requesting v5",
615 repo: "actions/upload-artifact",
616 requestedVer: "v5",
617 expectedVer: "v7.0.1",
618 strictMode: false,
619 shouldFallback: true,
620 },
621 {
622 name: "fallback for upload-artifact v4.6.2 resolves to v7.0.1",
623 repo: "actions/upload-artifact",
624 requestedVer: "v4.6.2",
625 expectedVer: "v7.0.1",
626 strictMode: false,
627 shouldFallback: true,
628 },
629 }
630
631 for _, tt := range tests {
632 t.Run(tt.name, func(t *testing.T) {
633 data := &WorkflowData{
634 StrictMode: tt.strictMode,

Callers

nothing calls this directly

Calls 3

getActionPinWithDataFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected