From b5564935120d9f4055074206425313b0146ed52f Mon Sep 17 00:00:00 2001 From: Troy Chiu <114708546+troychiu@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:26:18 -0700 Subject: [PATCH] integration test config (#5058) Signed-off-by: troychiu --- .../script/integration/k8s/integration.yaml | 3 +++ flyteadmin/tests/bootstrap.go | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/flyteadmin/script/integration/k8s/integration.yaml b/flyteadmin/script/integration/k8s/integration.yaml index 4fae0bab27d..5e57935316d 100644 --- a/flyteadmin/script/integration/k8s/integration.yaml +++ b/flyteadmin/script/integration/k8s/integration.yaml @@ -417,6 +417,9 @@ spec: - name: flyteadmin image: flyteadmin:test imagePullPolicy: IfNotPresent + env: + - name: USE_INTEGRATION_TEST_CONFIG + value: "True" securityContext: privileged: true readinessProbe: diff --git a/flyteadmin/tests/bootstrap.go b/flyteadmin/tests/bootstrap.go index 9fd3b270269..aa1808282d9 100644 --- a/flyteadmin/tests/bootstrap.go +++ b/flyteadmin/tests/bootstrap.go @@ -6,6 +6,7 @@ package tests import ( "context" "fmt" + "os" "gorm.io/gorm" @@ -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", @@ -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", }, } }