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

Function TestCacheIntegrityLevel

pkg/workflow/cache_integrity_test.go:289–309  ·  view source on GitHub ↗

TestCacheIntegrityLevel verifies integrity level extraction from config.

(t *testing.T)

Source from the content-addressed store, hash-verified

287
288// TestCacheIntegrityLevel verifies integrity level extraction from config.
289func TestCacheIntegrityLevel(t *testing.T) {
290 tests := []struct {
291 name string
292 cfg *GitHubToolConfig
293 expected string
294 }{
295 {name: "nil config", cfg: nil, expected: defaultCacheIntegrityLevel},
296 {name: "empty config", cfg: &GitHubToolConfig{}, expected: defaultCacheIntegrityLevel},
297 {name: "merged integrity", cfg: &GitHubToolConfig{MinIntegrity: GitHubIntegrityMerged}, expected: "merged"},
298 {name: "approved integrity", cfg: &GitHubToolConfig{MinIntegrity: GitHubIntegrityApproved}, expected: "approved"},
299 {name: "unapproved integrity", cfg: &GitHubToolConfig{MinIntegrity: GitHubIntegrityUnapproved}, expected: "unapproved"},
300 {name: "none integrity", cfg: &GitHubToolConfig{MinIntegrity: GitHubIntegrityNone}, expected: "none"},
301 }
302
303 for _, tt := range tests {
304 t.Run(tt.name, func(t *testing.T) {
305 result := cacheIntegrityLevel(tt.cfg)
306 assert.Equal(t, tt.expected, result, "Integrity level mismatch for %s", tt.name)
307 })
308 }
309}
310
311// TestComputeIntegrityCacheKey_WithGitHubConfig verifies that computeIntegrityCacheKey
312// produces the correct key when a GitHub guard policy is configured.

Callers

nothing calls this directly

Calls 2

cacheIntegrityLevelFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected