TestCacheMemoryGitCommitSteps verifies that the post-agent git commit step is generated.
(t *testing.T)
| 489 | |
| 490 | // TestCacheMemoryGitCommitSteps verifies that the post-agent git commit step is generated. |
| 491 | func TestCacheMemoryGitCommitSteps(t *testing.T) { |
| 492 | toolsMap := map[string]any{ |
| 493 | "cache-memory": true, |
| 494 | } |
| 495 | |
| 496 | toolsConfig, err := ParseToolsConfig(toolsMap) |
| 497 | require.NoError(t, err, "Should parse tools config") |
| 498 | |
| 499 | compiler := NewCompiler() |
| 500 | cacheMemoryConfig, err := compiler.extractCacheMemoryConfig(toolsConfig) |
| 501 | require.NoError(t, err, "Should extract cache-memory config") |
| 502 | |
| 503 | data := &WorkflowData{ |
| 504 | CacheMemoryConfig: cacheMemoryConfig, |
| 505 | } |
| 506 | |
| 507 | var builder strings.Builder |
| 508 | generateCacheMemoryGitCommitSteps(&builder, data) |
| 509 | output := builder.String() |
| 510 | |
| 511 | assert.Contains(t, output, "Commit cache-memory changes", |
| 512 | "Should include git commit step") |
| 513 | assert.Contains(t, output, "commit_cache_memory_git.sh", |
| 514 | "Should reference the git commit script") |
| 515 | assert.Contains(t, output, "if: always()", |
| 516 | "Git commit step should always run") |
| 517 | assert.Contains(t, output, "GH_AW_CACHE_DIR: /tmp/gh-aw/cache-memory", |
| 518 | "Should set the cache dir env var") |
| 519 | } |
| 520 | |
| 521 | // TestCacheMemoryGitCommitSteps_RestoreOnlySkipped verifies that restore-only caches |
| 522 | // do not get a git commit step. |
nothing calls this directly
no test coverage detected