mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-06-03 20:12:58 +00:00
24 lines
547 B
Go
24 lines
547 B
Go
package database
|
|
|
|
import "testing"
|
|
|
|
func TestNewRedisRejectsEmptyURL(t *testing.T) {
|
|
if _, err := NewRedis(""); err == nil {
|
|
t.Fatal("expected error for empty redis URL")
|
|
}
|
|
}
|
|
|
|
func TestNewRedisRejectsInvalidURL(t *testing.T) {
|
|
if _, err := NewRedis("://bad-redis-url"); err == nil {
|
|
t.Fatal("expected error for invalid redis URL")
|
|
}
|
|
}
|
|
|
|
func TestNewRedisAcceptsValidURL(t *testing.T) {
|
|
r, err := NewRedis("redis://:password@localhost:6379/0")
|
|
if err != nil {
|
|
t.Fatalf("expected valid redis URL, got error: %v", err)
|
|
}
|
|
_ = r.Close()
|
|
}
|