feat: bootstrap console administrator
This commit is contained in:
35
internal/storage/mysql/bootstrap_test.go
Normal file
35
internal/storage/mysql/bootstrap_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBootstrapConsoleAdministratorRequiresUsernameAndPassword(t *testing.T) {
|
||||
base := BootstrapInput{Application: "app", Namespace: "default", Environment: "test", Queue: "queue"}
|
||||
for name, in := range map[string]BootstrapInput{
|
||||
"username without password": func() BootstrapInput {
|
||||
in := base
|
||||
in.ConsoleUsername = "admin"
|
||||
return in
|
||||
}(),
|
||||
"password without username": func() BootstrapInput {
|
||||
in := base
|
||||
in.ConsolePassword = "a sufficiently long password"
|
||||
return in
|
||||
}(),
|
||||
"display name without account": func() BootstrapInput {
|
||||
in := base
|
||||
in.ConsoleDisplayName = "Orbit 管理员"
|
||||
return in
|
||||
}(),
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
err := Bootstrap(context.Background(), nil, in, func(BootstrapResult) error { return nil })
|
||||
if err == nil || !strings.Contains(err.Error(), "console username and password") {
|
||||
t.Fatalf("expected console administrator validation error, got %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user