Skip to content

Commit 53fe9c2

Browse files
committed
Introduce new parameter Expected Failures List
The Expected Failures List parameter will help with specifying set of tests whose failures we want to ignore. By adding test to this list, its failure will not have impact on the jobs pass/fail. It can help with not having to re-run long running jobs and save time and resources in specific cases, for example when dealing with flaky tests.
1 parent 06ff0ea commit 53fe9c2

7 files changed

+52
-0
lines changed

api/bases/test.openstack.org_tempests.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ spec:
168168
description: A content of exclude.txt file that is passed to tempest
169169
via --exclude-list
170170
type: string
171+
expectedFailuresList:
172+
description: The expectedFailuresList parameter contains tests
173+
that should not count as failures. When a test from this list
174+
fails, the test pod ends with Completed state rather than with
175+
Error state.
176+
type: string
171177
externalPlugin:
172178
description: ExternalPlugin contains information about plugin
173179
that should be installed within the tempest test pod. If this
@@ -603,6 +609,12 @@ spec:
603609
description: A content of exclude.txt file that is passed
604610
to tempest via --exclude-list
605611
type: string
612+
expectedFailuresList:
613+
description: The expectedFailuresList parameter contains
614+
tests that should not count as failures. When a test from
615+
this list fails, the test pod ends with Completed state
616+
rather than with Error state.
617+
type: string
606618
externalPlugin:
607619
description: ExternalPlugin contains information about plugin
608620
that should be installed within the tempest test pod.

api/v1beta1/tempest_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ type TempestRunSpec struct {
151151
// A content of exclude.txt file that is passed to tempest via --exclude-list
152152
ExcludeList string `json:"excludeList"`
153153

154+
// +kubebuilder:validation:Optional
155+
// +operator-sdk:csv:customresourcedefinitions:type=spec
156+
// The expectedFailuresList parameter contains tests that should not count
157+
// as failures. When a test from this list fails, the test pod ends with
158+
// Completed state rather than with Error state.
159+
ExpectedFailuresList string `json:"expectedFailuresList"`
160+
154161
// +kubebuilder:validation:Optional
155162
// +operator-sdk:csv:customresourcedefinitions:type=spec
156163
// +kubebuilder:default:=0

api/v1beta1/tempest_types_workflow.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ type WorkflowTempestRunSpec struct {
3030
// A content of exclude.txt file that is passed to tempest via --exclude-list
3131
ExcludeList *string `json:"excludeList,omitempty"`
3232

33+
// +kubebuilder:validation:Optional
34+
// +operator-sdk:csv:customresourcedefinitions:type=spec
35+
// The expectedFailuresList parameter contains tests that should not count
36+
// as failures. When a test from this list fails, the test pod ends with
37+
// Completed state rather than with Error state.
38+
ExpectedFailuresList *string `json:"expectedFailuresList,omitempty"`
39+
3340
// +kubebuilder:validation:Optional
3441
// +operator-sdk:csv:customresourcedefinitions:type=spec
3542
// Concurrency value that is passed to tempest via --concurrency

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ spec:
168168
description: A content of exclude.txt file that is passed to tempest
169169
via --exclude-list
170170
type: string
171+
expectedFailuresList:
172+
description: The expectedFailuresList parameter contains tests
173+
that should not count as failures. When a test from this list
174+
fails, the test pod ends with Completed state rather than with
175+
Error state.
176+
type: string
171177
externalPlugin:
172178
description: ExternalPlugin contains information about plugin
173179
that should be installed within the tempest test pod. If this
@@ -603,6 +609,12 @@ spec:
603609
description: A content of exclude.txt file that is passed
604610
to tempest via --exclude-list
605611
type: string
612+
expectedFailuresList:
613+
description: The expectedFailuresList parameter contains
614+
tests that should not count as failures. When a test from
615+
this list fails, the test pod ends with Completed state
616+
rather than with Error state.
617+
type: string
606618
externalPlugin:
607619
description: ExternalPlugin contains information about plugin
608620
that should be installed within the tempest test pod.

config/samples/test_v1beta1_tempest.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ spec:
4646
concurrency: 8
4747
# excludeList: | # <-- Use | to preserve \n
4848
# tempest.api.identity.v3.*
49+
# expectedFailuresList: | # <-- Use | to preserve \n
50+
# tempest.api.identity.v3.test_tokens.TokensV3Test.test_create_token
4951
# workerFile: | # <-- Use | to preserve \n
5052
# - worker:
5153
# - tempest.api.*

controllers/tempest_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,13 @@ func (r *TempestReconciler) setTempestConfigVars(envVars map[string]string,
444444
envVars["TEMPEST_EXCLUDE_LIST"] = testOperatorDir + excludeListFile
445445
}
446446

447+
value = mergeWithWorkflow(tRun.ExpectedFailuresList, wtRun.ExpectedFailuresList)
448+
if len(value) != 0 {
449+
expectedFailuresListFile := "expected_failures.txt"
450+
customData[expectedFailuresListFile] = value
451+
envVars["TEMPEST_EXPECTED_FAILURES_LIST"] = testOperatorDir + expectedFailuresListFile
452+
}
453+
447454
// Bool
448455
tempestBoolEnvVars := map[string]bool{
449456
"TEMPEST_SERIAL": mergeWithWorkflow(tRun.Serial, wtRun.Serial),

0 commit comments

Comments
 (0)