feat: initialize shared tenant workbench data
This commit is contained in:
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
func TestNormalizeMySQLTimeOptions(t *testing.T) {
|
||||
link, err := normalizeMySQLTimeOptions("user:pass@tcp(127.0.0.1:3306)/tinode?charset=utf8mb4")
|
||||
link, err := normalizeMySQLTimeOptions("user:pass@tcp(127.0.0.1:3306)/meeting_im?charset=utf8mb4")
|
||||
if err != nil {
|
||||
t.Fatalf("normalize raw mysql dsn: %v", err)
|
||||
}
|
||||
if !strings.HasPrefix(link, "mysql:user:pass@tcp(127.0.0.1:3306)/tinode?") {
|
||||
if !strings.HasPrefix(link, "mysql:user:pass@tcp(127.0.0.1:3306)/meeting_im?") {
|
||||
t.Fatalf("unexpected normalized link: %s", link)
|
||||
}
|
||||
if !strings.Contains(link, "loc=UTC") || !strings.Contains(link, "parseTime=true") {
|
||||
@@ -20,17 +20,17 @@ func TestNormalizeMySQLTimeOptions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalizeMySQLTimeOptionsRejectsUnsupportedFormat(t *testing.T) {
|
||||
if _, err := normalizeMySQLTimeOptions("postgres://user:pass@127.0.0.1:5432/tinode"); err == nil {
|
||||
if _, err := normalizeMySQLTimeOptions("postgres://user:pass@127.0.0.1:5432/meeting_im"); err == nil {
|
||||
t.Fatal("expected unsupported format error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReplaceMySQLDatabaseUsesUTC(t *testing.T) {
|
||||
link, err := replaceMySQLDatabase("mysql:user:pass@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=false&charset=utf8mb4", "tinode")
|
||||
link, err := replaceMySQLDatabase("mysql:user:pass@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=false&charset=utf8mb4", "meeting_im")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, expected := range []string{"/tinode?", "loc=UTC", "parseTime=true", "charset=utf8mb4"} {
|
||||
for _, expected := range []string{"/meeting_im?", "loc=UTC", "parseTime=true", "charset=utf8mb4"} {
|
||||
if !strings.Contains(link, expected) {
|
||||
t.Fatalf("link %q does not contain %q", link, expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user