refactor: Remove Token management and integrate Redis for authentication
- Deleted the Token model and its repository, transitioning to a Redis-based token management system. - Updated the service layer to utilize Redis for token storage, enhancing performance and scalability. - Refactored the container to remove TokenRepository and integrate the new token service. - Cleaned up the Dockerfile and other files by removing unnecessary whitespace and comments. - Enhanced error handling and logging for Redis initialization and usage.
This commit is contained in:
27
internal/testutil/testutil_test.go
Normal file
27
internal/testutil/testutil_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package testutil
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNewTestDB(t *testing.T) {
|
||||
db := NewTestDB(t)
|
||||
sqlDB, err := db.DB()
|
||||
if err != nil {
|
||||
t.Fatalf("DB() err: %v", err)
|
||||
}
|
||||
if err := sqlDB.Ping(); err != nil {
|
||||
t.Fatalf("ping err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewTestCache(t *testing.T) {
|
||||
cache := NewTestCache()
|
||||
if cache.Policy.UserTTL == 0 {
|
||||
t.Fatalf("expected defaults filled")
|
||||
}
|
||||
// disabled cache should not error on Set
|
||||
if err := cache.Set(nil, "k", "v"); err != nil {
|
||||
t.Fatalf("Set on disabled cache should be nil err, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user