Skip to content

Commit

Permalink
integration test config (flyteorg#5058)
Browse files Browse the repository at this point in the history
Signed-off-by: troychiu <[email protected]>
  • Loading branch information
troychiu authored and yubofredwang committed Mar 26, 2024
1 parent aa58477 commit b556493
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions flyteadmin/script/integration/k8s/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ spec:
- name: flyteadmin
image: flyteadmin:test
imagePullPolicy: IfNotPresent
env:
- name: USE_INTEGRATION_TEST_CONFIG
value: "True"
securityContext:
privileged: true
readinessProbe:
Expand Down
23 changes: 18 additions & 5 deletions flyteadmin/tests/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package tests
import (
"context"
"fmt"
"os"

"gorm.io/gorm"

Expand All @@ -19,9 +20,19 @@ const insertExecutionQueryStr = `INSERT INTO "executions" ` +
`("execution_project","execution_domain","execution_name","phase","launch_plan_id","workflow_id") ` +
`VALUES ('%s', '%s', '%s', '%s', '%d', '%d')`

const integrationTestConfigEnvVar = "USE_INTEGRATION_TEST_CONFIG"

var adminScope = promutils.NewScope("flyteadmin")

func getDbConfig() *database.DbConfig {
if os.Getenv(integrationTestConfigEnvVar) == "True" {
return getIntegrationDbConfig()
} else {
return getSandboxDbConfig()
}
}

func getIntegrationDbConfig() *database.DbConfig {
return &database.DbConfig{
Postgres: database.PostgresConfig{
Host: "postgres",
Expand All @@ -32,13 +43,15 @@ func getDbConfig() *database.DbConfig {
}
}

func getLocalDbConfig() *database.DbConfig {
// Run `flytectl demo start` to start the sandbox
func getSandboxDbConfig() *database.DbConfig {
return &database.DbConfig{
Postgres: database.PostgresConfig{
Host: "localhost",
Port: 5432,
DbName: "flyteadmin",
User: "postgres",
Host: "localhost",
Port: 30001,
DbName: "flyte",
Password: "postgres",
User: "postgres",
},
}
}
Expand Down

0 comments on commit b556493

Please sign in to comment.