TestCacheMemoryStepsNoPolicy verifies that the generated cache key uses the nopolicy sentinel when no guard policy is configured.
(t *testing.T)
| 458 | // TestCacheMemoryStepsNoPolicy verifies that the generated cache key uses the |
| 459 | // nopolicy sentinel when no guard policy is configured. |
| 460 | func 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. |
| 491 | func TestCacheMemoryGitCommitSteps(t *testing.T) { |
nothing calls this directly
no test coverage detected