- 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.
28 lines
546 B
Go
28 lines
546 B
Go
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)
|
|
}
|
|
}
|
|
|
|
|