Skip to content

Commit

Permalink
fix(build): put in a nasty sleep because cache invalidation
Browse files Browse the repository at this point in the history
Signed-off-by: George MacRorie <[email protected]>
  • Loading branch information
GeorgeMac committed Jun 6, 2024
1 parent 64edf1f commit a6d52bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build/testing/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ func withCockroach(fn testCaseFn) testCaseFn {
func cache(ctx context.Context, _ *dagger.Client, base, flipt *dagger.Container, conf testConfig) func() error {
flipt = flipt.
WithEnvVariable("FLIPT_LOG_LEVEL", "DEBUG").
WithEnvVariable("FLIPT_CACHE_ENABLED", "true")
WithEnvVariable("FLIPT_CACHE_ENABLED", "true").
WithEnvVariable("FLIPT_CACHE_TTL", "1s")

return suite(ctx, "api", base, flipt.WithExec(nil), conf)
}
Expand Down Expand Up @@ -379,6 +380,7 @@ func cacheWithTLS(ctx context.Context, client *dagger.Client, base, flipt *dagge
flipt = flipt.
WithEnvVariable("FLIPT_LOG_LEVEL", "DEBUG").
WithEnvVariable("FLIPT_CACHE_ENABLED", "true").
WithEnvVariable("FLIPT_CACHE_TTL", "1s").
WithEnvVariable("FLIPT_CACHE_BACKEND", "redis").
WithEnvVariable("FLIPT_CACHE_REDIS_REQUIRE_TLS", "true").
WithEnvVariable("FLIPT_CACHE_REDIS_HOST", "redis").
Expand Down
12 changes: 11 additions & 1 deletion build/testing/integration/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"testing"
"time"

"github.com/gofrs/uuid"
"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -101,7 +102,7 @@ func API(t *testing.T, ctx context.Context, client sdk.SDK, opts integration.Tes
assert.Equal(t, "Some kind of description", updated.Description)
})

for _, namespace := range integration.Namespaces {
for i, namespace := range integration.Namespaces {
t.Run(fmt.Sprintf("namespace %q", namespace.Key), func(t *testing.T) {
t.Run("Flags and Variants", func(t *testing.T) {
t.Log("Create a new enabled flag with key \"test\".")
Expand Down Expand Up @@ -1323,6 +1324,15 @@ func API(t *testing.T, ctx context.Context, client sdk.SDK, opts integration.Tes
}
})
})

if i < len(integration.Namespaces)-1 {
// this is lame I know, but its for the cache to attempt to ensure
// evictions between each loop iteration so that we don't polute
// the state between runs
// we could always thread something in to trigger this just
// for the cache tests this impacts things too much
time.Sleep(time.Second)
}
}

t.Run("Metrics", func(t *testing.T) {
Expand Down

0 comments on commit a6d52bb

Please sign in to comment.