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

Function TestComputePolicyHash_NoPolicy

pkg/workflow/cache_integrity_test.go:15–31  ·  view source on GitHub ↗

TestComputePolicyHash_NoPolicy verifies that workflows without a guard policy use the "nopolicy" sentinel hash.

(t *testing.T)

Source from the content-addressed store, hash-verified

13// TestComputePolicyHash_NoPolicy verifies that workflows without a guard policy
14// use the "nopolicy" sentinel hash.
15func TestComputePolicyHash_NoPolicy(t *testing.T) {
16 tests := []struct {
17 name string
18 githubConfig *GitHubToolConfig
19 }{
20 {name: "nil config", githubConfig: nil},
21 {name: "empty config", githubConfig: &GitHubToolConfig{}},
22 {name: "config without min-integrity", githubConfig: &GitHubToolConfig{AllowedRepos: "all"}},
23 }
24
25 for _, tt := range tests {
26 t.Run(tt.name, func(t *testing.T) {
27 hash := computePolicyHash(tt.githubConfig)
28 assert.Equal(t, noPolicySentinel, hash, "Should return nopolicy sentinel when no guard policy is configured")
29 })
30 }
31}
32
33// TestComputePolicyHash_Deterministic verifies that the same policy always produces the same hash.
34func TestComputePolicyHash_Deterministic(t *testing.T) {

Callers

nothing calls this directly

Calls 2

computePolicyHashFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected