MCPcopy Index your code
hub / github.com/dagger/dagger / TestRemoteMetadataCacheKeyIsolation

Function TestRemoteMetadataCacheKeyIsolation

core/git_remote_test.go:39–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func 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
60func TestNamedFetchRefSpecs(t *testing.T) {
61 commitSHA := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

Callers

nothing calls this directly

Calls 6

GetOrInitArbitraryMethod · 0.95
NewCacheFunction · 0.92
ArbitraryValueFuncFunction · 0.92
BackgroundMethod · 0.65
EqualMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected