MCPcopy Index your code
hub / github.com/dosco/graphjin / TestFilesystemFragmentCacheOptions

Function TestFilesystemFragmentCacheOptions

core/cache_response_test.go:141–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func TestFilesystemFragmentCacheOptions(t *testing.T) {
142 s := &gstate{gj: &graphjinEngine{conf: &Config{Filesystems: []FilesystemConfig{
143 {Name: "s3_default", Backend: "s3"},
144 {Name: "gcs_public", Backend: "gcs", PublicBaseURL: "https://cdn.example.com"},
145 {Name: "s3_short", Backend: "s3", PresignTTL: 20 * time.Second},
146 {Name: "local", Backend: "local"},
147 }}}}
148
149 if got := s.remoteFragmentCacheOptions("filesystem", "s3_default").HardTTL; got != 14*time.Minute+30*time.Second {
150 t.Fatalf("default s3 hard ttl = %s, want 14m30s", got)
151 }
152 if got := s.remoteFragmentCacheOptions("filesystem", "gcs_public"); got != (CacheEntryOptions{}) {
153 t.Fatalf("public base url should not cap cache ttl, got %+v", got)
154 }
155 if got := s.remoteFragmentCacheOptions("filesystem", "s3_short"); !got.NoStore {
156 t.Fatalf("short presign ttl should skip cache, got %+v", got)
157 }
158 if got := s.remoteFragmentCacheOptions("filesystem", "local"); got != (CacheEntryOptions{}) {
159 t.Fatalf("local filesystem should not cap cache ttl, got %+v", got)
160 }
161}
162
163func TestRemoteFragmentKeyIncludesResolverFingerprint(t *testing.T) {
164 s := &gstate{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected