Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89d7055382 |
@@ -434,21 +434,21 @@ func TestService_Get_Caching(t *testing.T) {
|
||||
|
||||
// TestService_Get_ServesSourceAndVariantCachedTwoDaysAgo caches a source and
|
||||
// a variant of it and sets back two days every time pixa stored for them.
|
||||
// For the source: fetched_at in source_metadata, fetched_at and
|
||||
// last_accessed_at in source_content, the fetched_at in its metadata file,
|
||||
// and the access and modification times of its file and of its metadata
|
||||
// file. For the variant: created_at and last_accessed_at in variant_content,
|
||||
// the created_at in its .meta file, and the access and modification times of
|
||||
// its file and of its .meta file. It then checks that the variant is still
|
||||
// served from the cache and that a new variant is made from the cached source
|
||||
// without fetching it again.
|
||||
// For the source: fetched_at in source_metadata and in source_content, the
|
||||
// fetched_at in its metadata file, and the access and modification times of
|
||||
// its file and of its metadata file. For the variant: created_at in
|
||||
// variant_content, the created_at in its .meta file, and the access and
|
||||
// modification times of its file and of its .meta file. It then checks that
|
||||
// the variant is still served from the cache and that a new variant is made
|
||||
// from the cached source without fetching it again.
|
||||
//
|
||||
// Left at the present: the files' status change and birth times, which a
|
||||
// program cannot set, and the times of the directories holding the files,
|
||||
// which other entries share. The source's stored response headers are empty,
|
||||
// as the mock fetcher sends none. expires_at, etag and last_modified in
|
||||
// source_metadata and in the metadata file are never written, nor are the
|
||||
// request_cache and output_content tables.
|
||||
// Left at the present: last_accessed_at in source_content and variant_content,
|
||||
// which is when eviction last saw the entry used, not when it was cached; the
|
||||
// files' status change and birth times, which a program cannot set; and the
|
||||
// times of the directories holding the files, which other entries share. The
|
||||
// source's stored response headers are empty, as the mock fetcher sends none.
|
||||
// expires_at, etag and last_modified in source_metadata and in the metadata
|
||||
// file are never written, nor are the request_cache and output_content tables.
|
||||
func TestService_Get_ServesSourceAndVariantCachedTwoDaysAgo(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -522,7 +522,6 @@ func backdateSource(
|
||||
updateOneRow(t, cache,
|
||||
`UPDATE source_content SET fetched_at = ? WHERE content_hash = ?`,
|
||||
dbTime, meta.ContentHash)
|
||||
setSourceLastAccessed(t, cache, ContentHash(meta.ContentHash), when)
|
||||
|
||||
for _, path := range []string{
|
||||
cache.srcContent.hashToPath(ContentHash(meta.ContentHash)),
|
||||
@@ -572,7 +571,6 @@ func backdateVariant(
|
||||
updateOneRow(t, cache,
|
||||
`UPDATE variant_content SET created_at = ? WHERE cache_key = ?`,
|
||||
when.UTC().Format(sqliteTimestampFormat), string(key))
|
||||
setVariantLastAccessed(t, cache, key, when)
|
||||
|
||||
for _, file := range []string{path, path + variantMetaSuffix} {
|
||||
err = os.Chtimes(file, when, when)
|
||||
|
||||
Reference in New Issue
Block a user