(t *testing.T)
| 139 | } |
| 140 | |
| 141 | func 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 | |
| 163 | func TestRemoteFragmentKeyIncludesResolverFingerprint(t *testing.T) { |
| 164 | s := &gstate{ |
nothing calls this directly
no test coverage detected