feat(19.3-04): Journal purges through the framework's cooler.SiteCachePurger
- classes.SiteCachePurger, NewSiteCachePurger, PurgeSiteCacheAfterCommit and the key and limit constants stay as deprecated aliases for one release - wireSiteCache: framework keys site_cache.* win (Journal keys ignored with a warning); with only golem15.journal.site_cache.* set it publishes the purger from them with a deprecation warning, so menu and FAQ saves purge through it too - controllers take the purger from cooler.SiteCacheFromApp - TestSiteCacheFrameworkKeysWin; README documents both key sets
This commit is contained in:
@@ -329,3 +329,28 @@ func TestPostsAdminPurgesSiteCache(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TestSiteCacheFrameworkKeysWin proves the framework keys site_cache.* take
|
||||
// precedence over the Journal's deprecated keys: with both set, a category
|
||||
// save purges through the framework target only.
|
||||
func TestSiteCacheFrameworkKeysWin(t *testing.T) {
|
||||
framework := newPurgeReceiver(t)
|
||||
alias := newPurgeReceiver(t)
|
||||
env := newPostsEnv(t, append(alias.env(),
|
||||
"SUMMER_SITE_CACHE__PURGE_URL="+framework.srv.URL+"/api/__site__/cache/purge",
|
||||
"SUMMER_SITE_CACHE__PURGE_TOKEN="+purgeTestToken,
|
||||
)...)
|
||||
token := env.admin(t, controllers.PermissionAccessCategories)
|
||||
env.expect(t, http.StatusCreated, http.MethodPost, adminAPI(adminCategoriesPath), token, map[string]any{
|
||||
"name": map[string]any{"en": "Framework keys"},
|
||||
"slug": map[string]any{"en": "framework-keys"},
|
||||
})
|
||||
got := framework.take()
|
||||
if len(got) != 1 || got[0].Path != "/api/__site__/cache/purge" || got[0].Body["kind"] != "category" || got[0].Body["slug"] != "framework-keys" ||
|
||||
got[0].Authorization != "Bearer "+purgeTestToken {
|
||||
t.Fatalf("framework receiver got %+v, want one category purge", got)
|
||||
}
|
||||
if got := alias.take(); len(got) != 0 {
|
||||
t.Fatalf("the deprecated Journal target got %d requests: %+v", len(got), got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user