feat(deploy): add clone-and-run docker installer
This commit is contained in:
@@ -34,10 +34,7 @@ func TestDobotAIDingTalkComposeOwnsApplicationAndPostgres(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, required := range []string{
|
||||
"configure_env.py",
|
||||
"dobotai-dingtalk-start",
|
||||
} {
|
||||
for _, required := range []string{"configure_env.py", "dobotai-dingtalk-start"} {
|
||||
if !strings.Contains(string(configure), required) {
|
||||
t.Errorf("configure command missing %q", required)
|
||||
}
|
||||
@@ -47,10 +44,7 @@ func TestDobotAIDingTalkComposeOwnsApplicationAndPostgres(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, required := range []string{
|
||||
"docker exec -it dobotai-dingtalk",
|
||||
"/usr/local/bin/dobotai bootstrap-admin",
|
||||
} {
|
||||
for _, required := range []string{"docker exec -it dobotai-dingtalk", "/usr/local/bin/dobotai bootstrap-admin"} {
|
||||
if !strings.Contains(string(bind), required) {
|
||||
t.Errorf("bind command missing %q", required)
|
||||
}
|
||||
@@ -133,15 +127,8 @@ func TestDobotAIDingTalkDockerInstallerPreparesDirectoriesDatabaseAndMigrations(
|
||||
}
|
||||
source := string(data)
|
||||
for _, required := range []string{
|
||||
"container",
|
||||
"secrets",
|
||||
"backups",
|
||||
"migrations",
|
||||
"postgres.env",
|
||||
"dobotai-postgres",
|
||||
"apply-migrations.sh",
|
||||
"docker compose",
|
||||
"umask 077",
|
||||
"container", "secrets", "backups", "migrations", "postgres.env",
|
||||
"dobotai-postgres", "apply-migrations.sh", "docker compose", "umask 077",
|
||||
} {
|
||||
if !strings.Contains(source, required) {
|
||||
t.Errorf("docker installer missing %q", required)
|
||||
@@ -159,15 +146,34 @@ func TestDobotAIDingTalkExistingDatabaseMigrationHasBackupAndRollbackBoundary(t
|
||||
}
|
||||
source := string(data)
|
||||
for _, required := range []string{
|
||||
"pg_dump -Fc",
|
||||
"pg_restore --list",
|
||||
"dobotai-postgres-data",
|
||||
"dobotai-dingtalk",
|
||||
"rollback",
|
||||
"apply-migrations.sh",
|
||||
"pg_dump -Fc", "pg_restore --list", "dobotai-postgres-data",
|
||||
"dobotai-dingtalk", "rollback", "apply-migrations.sh",
|
||||
} {
|
||||
if !strings.Contains(source, required) {
|
||||
t.Errorf("database adoption script missing %q", required)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootDockerInstallerIsCloneAndRunEntryPoint(t *testing.T) {
|
||||
data, err := os.ReadFile("../install-docker.sh")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
source := string(data)
|
||||
for _, required := range []string{
|
||||
"docker build",
|
||||
"dobotai-dingtalk:local-",
|
||||
"install_docker_if_missing",
|
||||
"docker compose version",
|
||||
"DOBOTAI_SOURCE_ROOT",
|
||||
"deploy/dobotai-dingtalk/install-docker.sh",
|
||||
} {
|
||||
if !strings.Contains(source, required) {
|
||||
t.Errorf("root installer missing %q", required)
|
||||
}
|
||||
}
|
||||
if strings.Contains(source, "${DOBOTAI_IMAGE") || strings.Contains(source, "DOBOTAI_IMAGE=?") {
|
||||
t.Fatal("root installer must not require an operator supplied DOBOTAI_IMAGE")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user