Skip to content

Commit b2947b1

Browse files
committed
f
1 parent 4c9958c commit b2947b1

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

dagger/cmx.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import (
1010
)
1111

1212
const (
13-
SSHUser = "ec-e2e-test"
14-
DataDir = "/var/lib/embedded-cluster-smoke-test-staging-app"
13+
SSHUser = "ec-e2e-test"
14+
DataDir = "/var/lib/embedded-cluster-smoke-test-staging-app"
15+
AppNamespace = "embedded-cluster-smoke-test-staging-app"
1516
)
1617

1718
// Provisions a new CMX VM for E2E testing.

dagger/validation.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func (i *CmxInstance) validateInstallationCRD(ctx context.Context) *CheckResult
176176
// Based on: e2e/scripts/common.sh::wait_for_nginx_pods, ensure_app_deployed, ensure_app_not_upgraded
177177
func (i *CmxInstance) validateAppDeployment(ctx context.Context, expectedAppVersion string, airgap bool) *CheckResult {
178178
result := &CheckResult{Passed: true}
179-
appNamespace := "kotsadm"
180179

181180
// Wait for nginx pods to be Running (with timeout)
182181
nginxReady := false
@@ -192,16 +191,16 @@ waitLoop:
192191
result.ErrorMessage = "nginx pods did not appear within timeout"
193192

194193
// Get debugging info
195-
pods, _ := i.Command(fmt.Sprintf(`kubectl get pods -n %s`, appNamespace)).Stdout(ctx)
196-
kotsadmPods, _ := i.Command(fmt.Sprintf(`kubectl get pods -n %s`, appNamespace)).Stdout(ctx)
197-
logs, _ := i.Command(fmt.Sprintf(`kubectl logs -n %s -l app=kotsadm --tail=50`, appNamespace)).Stdout(ctx)
194+
pods, _ := i.Command(fmt.Sprintf(`kubectl get pods -n %s`, AppNamespace)).Stdout(ctx)
195+
kotsadmPods, _ := i.Command(fmt.Sprintf(`kubectl get pods -n %s`, AppNamespace)).Stdout(ctx)
196+
logs, _ := i.Command(fmt.Sprintf(`kubectl logs -n %s -l app=kotsadm --tail=50`, AppNamespace)).Stdout(ctx)
198197

199198
result.Details = fmt.Sprintf("app pods:\n%s\n\nkotsadm pods:\n%s\n\nkotsadm logs:\n%s",
200199
pods, kotsadmPods, logs)
201200
return result
202201

203202
case <-ticker.C:
204-
stdout, err := i.Command(fmt.Sprintf(`kubectl get pods -n %s --no-headers`, appNamespace)).Stdout(ctx)
203+
stdout, err := i.Command(fmt.Sprintf(`kubectl get pods -n %s --no-headers`, AppNamespace)).Stdout(ctx)
205204
if err == nil && strings.Contains(stdout, "nginx") && strings.Contains(stdout, "Running") {
206205
nginxReady = true
207206
break waitLoop
@@ -225,7 +224,7 @@ waitLoop:
225224
}
226225
} else {
227226
// For online, use kubectl kots
228-
versions, err := i.Command(`kubectl kots get versions -n kotsadm embedded-cluster-smoke-test-staging-app`).Stdout(ctx)
227+
versions, err := i.Command(fmt.Sprintf(`kubectl kots get versions -n %s embedded-cluster-smoke-test-staging-app`, AppNamespace)).Stdout(ctx)
229228
if err != nil {
230229
result.Passed = false
231230
result.ErrorMessage = fmt.Sprintf("failed to get app versions: %v", err)
@@ -254,7 +253,7 @@ waitLoop:
254253
}
255254

256255
// Check for "second" app pods (should not exist for fresh install)
257-
secondPods, _ := i.Command(`kubectl get pods -n ${appNamespace} -l app=second`).Stdout(ctx)
256+
secondPods, _ := i.Command(fmt.Sprintf(`kubectl get pods -n %s -l app=second`, AppNamespace)).Stdout(ctx)
258257
if strings.Contains(secondPods, "second") {
259258
result.Passed = false
260259
result.ErrorMessage = "found pods from app update (upgrade artifact)"
@@ -271,7 +270,7 @@ waitLoop:
271270
// Based on: e2e/scripts/common.sh::ensure_app_deployed_airgap
272271
func (i *CmxInstance) ensureAppDeployedAirgap(ctx context.Context, expectedVersion string) error {
273272
// Get kotsadm authstring
274-
authStringCmd := `kubectl get secret -n kotsadm kotsadm-authstring -o jsonpath={.data.kotsadm-authstring}`
273+
authStringCmd := fmt.Sprintf(`kubectl get secret -n %s kotsadm-authstring -o jsonpath={.data.kotsadm-authstring}`, AppNamespace)
275274
authString64, err := i.Command(authStringCmd).Stdout(ctx)
276275
if err != nil {
277276
return fmt.Errorf("get authstring: %w", err)
@@ -285,14 +284,14 @@ func (i *CmxInstance) ensureAppDeployedAirgap(ctx context.Context, expectedVersi
285284
}
286285

287286
// Get kotsadm service IP
288-
kotsadmIPCmd := `kubectl get svc -n kotsadm kotsadm -o jsonpath={.spec.clusterIP}`
287+
kotsadmIPCmd := fmt.Sprintf(`kubectl get svc -n %s kotsadm -o jsonpath={.spec.clusterIP}`, AppNamespace)
289288
kotsadmIP, err := i.Command(kotsadmIPCmd).Stdout(ctx)
290289
if err != nil {
291290
return fmt.Errorf("get kotsadm IP: %w", err)
292291
}
293292

294293
// Get kotsadm service port
295-
kotsadmPortCmd := `kubectl get svc -n kotsadm kotsadm -o jsonpath={.spec.ports[?(@.name=="http")].port}`
294+
kotsadmPortCmd := fmt.Sprintf(`kubectl get svc -n %s kotsadm -o jsonpath={.spec.ports[?(@.name=="http")].port}`, AppNamespace)
296295
kotsadmPort, err := i.Command(kotsadmPortCmd).Stdout(ctx)
297296
if err != nil {
298297
return fmt.Errorf("get kotsadm port: %w", err)
@@ -336,7 +335,7 @@ func (i *CmxInstance) validateAdminConsole(ctx context.Context) *CheckResult {
336335
result := &CheckResult{Passed: true}
337336

338337
// Check kotsadm pods are running
339-
kotsadmPods, err := i.Command(`kubectl get pods -n kotsadm -l app=kotsadm --no-headers`).Stdout(ctx)
338+
kotsadmPods, err := i.Command(fmt.Sprintf(`kubectl get pods -n %s -l app=kotsadm --no-headers`, AppNamespace)).Stdout(ctx)
340339
if err != nil {
341340
result.Passed = false
342341
result.ErrorMessage = fmt.Sprintf("failed to get kotsadm pods: %v", err)
@@ -351,7 +350,7 @@ func (i *CmxInstance) validateAdminConsole(ctx context.Context) *CheckResult {
351350
}
352351

353352
// Check kubectl kots command works
354-
_, err = i.Command(`kubectl kots get apps -n kotsadm`).Stdout(ctx)
353+
_, err = i.Command(fmt.Sprintf(`kubectl kots get apps -n %s`, AppNamespace)).Stdout(ctx)
355354
if err != nil {
356355
result.Passed = false
357356
result.ErrorMessage = fmt.Sprintf("kubectl kots get apps failed: %v", err)
@@ -360,7 +359,7 @@ func (i *CmxInstance) validateAdminConsole(ctx context.Context) *CheckResult {
360359
}
361360

362361
// Check admin console branding configmap has DR label
363-
cmCheck, err := i.Command(`kubectl get cm -n kotsadm kotsadm-application-metadata --show-labels`).Stdout(ctx)
362+
cmCheck, err := i.Command(fmt.Sprintf(`kubectl get cm -n %s kotsadm-application-metadata --show-labels`, AppNamespace)).Stdout(ctx)
364363
if err != nil {
365364
result.Passed = false
366365
result.ErrorMessage = fmt.Sprintf("failed to get kotsadm-application-metadata configmap: %v", err)
@@ -372,7 +371,7 @@ func (i *CmxInstance) validateAdminConsole(ctx context.Context) *CheckResult {
372371
result.ErrorMessage = "kotsadm-application-metadata configmap missing DR label"
373372

374373
// Get full configmap details
375-
cmDetails, _ := i.Command(`kubectl get cm -n kotsadm kotsadm-application-metadata -o yaml`).Stdout(ctx)
374+
cmDetails, _ := i.Command(fmt.Sprintf(`kubectl get cm -n %s kotsadm-application-metadata -o yaml`, AppNamespace)).Stdout(ctx)
376375
result.Details = fmt.Sprintf("configmap:\n%s", cmDetails)
377376
return result
378377
}

0 commit comments

Comments
 (0)