feat: live module and jenkins pipeline to harbor deploy
This commit is contained in:
@@ -7,20 +7,16 @@ import (
|
||||
"kra/internal/config"
|
||||
)
|
||||
|
||||
func TestMySQLDatabaseDSNIncludesNetworkTimeouts(t *testing.T) {
|
||||
dsn, err := databaseDSN(&config.Database{
|
||||
Driver: "mysql",
|
||||
User: "root",
|
||||
Password: "secret",
|
||||
Host: "mysql",
|
||||
Name: "kra",
|
||||
}, "")
|
||||
func TestMySQLBootstrapDSNDoesNotRequireTargetDatabase(t *testing.T) {
|
||||
value := &config.Database{Driver: "mysql", Host: "127.0.0.1", Port: "3306", User: "root", Password: "secret", Name: "new_database", Config: "parseTime=True"}
|
||||
copy := *value
|
||||
copy.Name = ""
|
||||
copy.Source = ""
|
||||
dsn, err := databaseDSN(©, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, option := range []string{"timeout=5s", "readTimeout=5s", "writeTimeout=5s"} {
|
||||
if !strings.Contains(dsn, option) {
|
||||
t.Fatalf("DSN %q does not contain %q", dsn, option)
|
||||
}
|
||||
if strings.Contains(dsn, "/new_database?") || !strings.Contains(dsn, "/?parseTime=True") {
|
||||
t.Fatalf("bootstrap DSN still selects target database: %q", dsn)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user