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

Function TestCacheMemoryStepsNoPolicy

pkg/workflow/cache_integrity_test.go:460–488  ·  view source on GitHub ↗

TestCacheMemoryStepsNoPolicy verifies that the generated cache key uses the nopolicy sentinel when no guard policy is configured.

(t *testing.T)

Source from the content-addressed store, hash-verified

458// TestCacheMemoryStepsNoPolicy verifies that the generated cache key uses the
459// nopolicy sentinel when no guard policy is configured.
460func TestCacheMemoryStepsNoPolicy(t *testing.T) {
461 toolsMap := map[string]any{
462 "cache-memory": true,
463 "github": map[string]any{
464 "allowed": []any{"get_repository"},
465 },
466 }
467
468 toolsConfig, err := ParseToolsConfig(toolsMap)
469 require.NoError(t, err, "Should parse tools config")
470
471 compiler := NewCompiler()
472 cacheMemoryConfig, err := compiler.extractCacheMemoryConfig(toolsConfig)
473 require.NoError(t, err, "Should extract cache-memory config")
474
475 parsedTools := NewTools(toolsMap)
476
477 data := &WorkflowData{
478 CacheMemoryConfig: cacheMemoryConfig,
479 ParsedTools: parsedTools,
480 }
481
482 var builder strings.Builder
483 generateCacheMemorySteps(&builder, data)
484 output := builder.String()
485
486 assert.Contains(t, output, "key: memory-none-nopolicy-",
487 "Cache key without policy should use none-nopolicy prefix")
488}
489
490// TestCacheMemoryGitCommitSteps verifies that the post-agent git commit step is generated.
491func TestCacheMemoryGitCommitSteps(t *testing.T) {

Callers

nothing calls this directly

Calls 6

ParseToolsConfigFunction · 0.85
NewCompilerFunction · 0.85
NewToolsFunction · 0.85
generateCacheMemoryStepsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected