Skip to content

Commit 79edf42

Browse files
kstrenkovalpiwowar
authored andcommitted
Add debug mode for test-operator
This patch introduces an option for test-operator that keeps the pod running even after a failure occured or after the file run_tempest.sh has reached its end (sleep infinity). It resolves the issue that oc rsh session is killed once the execution of the run_tempest.sh finishes.
1 parent 91bef10 commit 79edf42

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

api/bases/test.openstack.org_tempests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ spec:
6565
description: An URL of a tempest container image that should be used
6666
for the execution of tempest tests.
6767
type: string
68+
debug:
69+
default: false
70+
description: Activate debug mode. When debug mode is activated any
71+
error encountered inside the test-pod causes that the pod will be
72+
kept alive indefinitely (stuck in "Running" phase) or until the
73+
corresponding Tempest CR is deleted. This allows the user to debug
74+
any potential troubles with `oc rsh`.
75+
type: boolean
6876
networkAttachments:
6977
description: NetworkAttachments is a list of NetworkAttachment resource
7078
names to expose the services to the given network

api/v1beta1/tempest_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,15 @@ type TempestSpec struct {
346346
// spawned by the test operator.
347347
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
348348

349+
350+
// +kubebuilder:validation:Optional
351+
// +kubebuilder:default=false
352+
// Activate debug mode. When debug mode is activated any error encountered
353+
// inside the test-pod causes that the pod will be kept alive indefinitely
354+
// (stuck in "Running" phase) or until the corresponding Tempest CR is deleted.
355+
// This allows the user to debug any potential troubles with `oc rsh`.
356+
Debug bool `json:"debug,omitempty"`
357+
349358
// +kubebuilder:validation:Optional
350359
// This value contains a toleration that is applied to pods spawned by the
351360
// test pods that are spawned by the test-operator.

config/crd/bases/test.openstack.org_tempests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ spec:
6565
description: An URL of a tempest container image that should be used
6666
for the execution of tempest tests.
6767
type: string
68+
debug:
69+
default: false
70+
description: Activate debug mode. When debug mode is activated any
71+
error encountered inside the test-pod causes that the pod will be
72+
kept alive indefinitely (stuck in "Running" phase) or until the
73+
corresponding Tempest CR is deleted. This allows the user to debug
74+
any potential troubles with `oc rsh`.
75+
type: boolean
6876
networkAttachments:
6977
description: NetworkAttachments is a list of NetworkAttachment resource
7078
names to expose the services to the given network

config/samples/test_v1beta1_tempest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ spec:
88
containerImage: quay.io/podified-antelope-centos9/openstack-tempest:current-podified
99
# storageClass: local-storage
1010
# parallel: false
11+
# debug: false
1112

1213
# configOverwrite
1314
# ---------------

controllers/tempest_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ func (r *TempestReconciler) generateServiceConfigMaps(
595595
r.setTempestconfConfigVars(envVars, customData, instance, ctx, workflowStepNum)
596596
r.setConfigOverwrite(customData, instance.Spec.ConfigOverwrite)
597597

598+
envVars["TEMPEST_DEBUG_MODE"] = r.GetDefaultBool(instance.Spec.Debug)
599+
598600
cms := []util.Template{
599601
// ConfigMap
600602
{

0 commit comments

Comments
 (0)