Fix failing integration tests by clearing cache properly

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-05 07:41:57 +00:00
parent 3a0aef7731
commit c4e8c3ec67
3 changed files with 11 additions and 1 deletions

View File

@@ -2100,6 +2100,9 @@ func TestApiGetPropertyDisabled(t *testing.T) {
t.Fatal(err)
}
// Clear cache so the next request fetches fresh data from DB
cache.Delete(ctx, db.PropertyByIDCacheKey(property.ID))
// Try to get the disabled property
_, meta, err = requestResponseAPISuite[*apiPropertyOutput](ctx, nil,
http.MethodGet,

View File

@@ -390,8 +390,12 @@ func TestGetPuzzleDisabledProperty(t *testing.T) {
t.Fatal(err)
}
// Clear cache so we fetch fresh data
// Clear cache and reload the property from DB so it has Enabled: false
cache.Delete(ctx, db.PropertyBySitekeyCacheKey(sitekey))
_, err = store.Impl().RetrievePropertyBySitekey(ctx, sitekey)
if err != nil {
t.Fatal(err)
}
// Now the puzzle request should be forbidden
resp, err = puzzleSuite(ctx, sitekey, property.Domain)

View File

@@ -338,6 +338,9 @@ func orgPropertiesCacheKey(orgID int32, key string) CacheKey {
func propertyByIDCacheKey(propID int32) CacheKey {
return Int32CacheKey(propertyByIDCacheKeyPrefix, propID)
}
func PropertyByIDCacheKey(propID int32) CacheKey {
return Int32CacheKey(propertyByIDCacheKeyPrefix, propID)
}
func PropertyBySitekeyCacheKey(sitekey string) CacheKey {
return StringCacheKey(propertyBySitekeyCacheKeyPrefix, sitekey)
}