Skip to content

Commit d1c10d9

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 8ac41b9 commit d1c10d9

7 files changed

+46
-0
lines changed

api/bases/test.openstack.org_tempests.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ 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 expected_failures.txt file contains tests that
173+
should not count as failures for the job, as they are expected
174+
to fail.
175+
type: string
171176
externalPlugin:
172177
description: ExternalPlugin contains information about plugin
173178
that should be installed within the tempest test pod. If this
@@ -603,6 +608,11 @@ spec:
603608
description: A content of exclude.txt file that is passed
604609
to tempest via --exclude-list
605610
type: string
611+
expectedFailuresList:
612+
description: The expected_failures.txt file contains tests
613+
that should not count as failures for the job, as they
614+
are expected to fail.
615+
type: string
606616
externalPlugin:
607617
description: ExternalPlugin contains information about plugin
608618
that should be installed within the tempest test pod.

api/v1beta1/tempest_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ 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 expected_failures.txt file contains tests that should not count
157+
// as failures for the job, as they are expected to fail.
158+
ExpectedFailuresList string `json:"expectedFailuresList"`
159+
154160
// +kubebuilder:validation:Optional
155161
// +operator-sdk:csv:customresourcedefinitions:type=spec
156162
// +kubebuilder:default:=0

api/v1beta1/tempest_types_workflow.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ 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 expected_failures.txt file contains tests that should not count
36+
// as failures for the job, as they are expected to fail.
37+
ExpectedFailuresList *string `json:"expectedFailuresList,omitempty"`
38+
3339
// +kubebuilder:validation:Optional
3440
// +operator-sdk:csv:customresourcedefinitions:type=spec
3541
// 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ 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 expected_failures.txt file contains tests that
173+
should not count as failures for the job, as they are expected
174+
to fail.
175+
type: string
171176
externalPlugin:
172177
description: ExternalPlugin contains information about plugin
173178
that should be installed within the tempest test pod. If this
@@ -603,6 +608,11 @@ spec:
603608
description: A content of exclude.txt file that is passed
604609
to tempest via --exclude-list
605610
type: string
611+
expectedFailuresList:
612+
description: The expected_failures.txt file contains tests
613+
that should not count as failures for the job, as they
614+
are expected to fail.
615+
type: string
606616
externalPlugin:
607617
description: ExternalPlugin contains information about plugin
608618
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.*
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+
envVats["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)