(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func TestRemoteMetadataCacheKeyIsolation(t *testing.T) { |
| 40 | ctx := context.Background() |
| 41 | |
| 42 | cacheIface, err := dagql.NewCache(ctx, "", nil, nil) |
| 43 | require.NoError(t, err) |
| 44 | |
| 45 | remotePayload := `{"refs":[]}` |
| 46 | _, err = cacheIface.GetOrInitArbitrary(ctx, "git-remote-test-session", "git-remote-test-dedicated-key", dagql.ArbitraryValueFunc(remotePayload)) |
| 47 | require.NoError(t, err) |
| 48 | |
| 49 | gitInitCalls := 0 |
| 50 | gitPayload := `{"refs":[{"name":"refs/heads/main","sha":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}]}` |
| 51 | res, err := cacheIface.GetOrInitArbitrary(ctx, "git-remote-test-session", "git-current-call-key", func(context.Context) (any, error) { |
| 52 | gitInitCalls++ |
| 53 | return gitPayload, nil |
| 54 | }) |
| 55 | require.NoError(t, err) |
| 56 | require.Equal(t, 1, gitInitCalls, "unrelated call key should not be aliased to remote metadata payload") |
| 57 | require.Equal(t, gitPayload, res.Value()) |
| 58 | } |
| 59 | |
| 60 | func TestNamedFetchRefSpecs(t *testing.T) { |
| 61 | commitSHA := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
nothing calls this directly
no test coverage detected