| 14 | ) |
| 15 | |
| 16 | func TestActionCache(t *testing.T) { |
| 17 | // Create temporary directory for testing |
| 18 | tmpDir := testutil.TempDir(t, "test-*") |
| 19 | |
| 20 | cache := NewActionCache(tmpDir) |
| 21 | |
| 22 | // Test setting and getting |
| 23 | cache.Set("actions/checkout", "v5", "abc123") |
| 24 | |
| 25 | sha, found := cache.Get("actions/checkout", "v5") |
| 26 | if !found { |
| 27 | t.Error("Expected to find cached entry") |
| 28 | } |
| 29 | if sha != "abc123" { |
| 30 | t.Errorf("Expected SHA 'abc123', got '%s'", sha) |
| 31 | } |
| 32 | |
| 33 | // Test cache miss |
| 34 | _, found = cache.Get("actions/unknown", "v1") |
| 35 | if found { |
| 36 | t.Error("Expected cache miss for unknown action") |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | func TestActionCacheSaveLoad(t *testing.T) { |
| 41 | // Create temporary directory for testing |