MCPcopy
hub / github.com/appleboy/gin-jwt / setupRedisContainerForJWT

Function setupRedisContainerForJWT

auth_jwt_redis_test.go:21–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func setupRedisContainerForJWT(t *testing.T) (string, string) {
22 ctx := context.Background()
23 t.Helper()
24
25 // Start Redis container
26 redisContainer, err := redis.Run(ctx, "redis:8-alpine")
27 require.NoError(t, err, "failed to start Redis container")
28
29 // Get host and port
30 host, err := redisContainer.Host(ctx)
31 require.NoError(t, err, "failed to get Redis host")
32
33 mappedPort, err := redisContainer.MappedPort(ctx, "6379/tcp")
34 require.NoError(t, err, "failed to get Redis port")
35
36 t.Cleanup(func() {
37 if err := redisContainer.Terminate(ctx); err != nil {
38 t.Logf("failed to terminate Redis container: %s", err)
39 }
40 })
41
42 return host, mappedPort.Port()
43}
44
45func TestGinJWTMiddleware_RedisStore_Integration(t *testing.T) {
46 gin.SetMode(gin.TestMode)

Calls 1

CleanupMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…