Skip to content

Commit

Permalink
Introduce new parameter Expected Failures List
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kstrenkova committed Oct 30, 2024
1 parent 15f7600 commit 4e87034
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ spec:
description: A content of exclude.txt file that is passed to tempest
via --exclude-list
type: string
expectedFailuresList:
description: The expected_failures.txt file contains tests that
should not count as failures for the job, as they are expected
to fail.
type: string
externalPlugin:
description: ExternalPlugin contains information about plugin
that should be installed within the tempest test pod. If this
Expand Down Expand Up @@ -603,6 +608,11 @@ spec:
description: A content of exclude.txt file that is passed
to tempest via --exclude-list
type: string
expectedFailuresList:
description: The expected_failures.txt file contains tests
that should not count as failures for the job, as they
are expected to fail.
type: string
externalPlugin:
description: ExternalPlugin contains information about plugin
that should be installed within the tempest test pod.
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/tempest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ type TempestRunSpec struct {
// A content of exclude.txt file that is passed to tempest via --exclude-list
ExcludeList string `json:"excludeList"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// The expected_failures.txt file contains tests that should not count
// as failures for the job, as they are expected to fail.
ExpectedFailuresList string `json:"expectedFailuresList"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:default:=0
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/tempest_types_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ type WorkflowTempestRunSpec struct {
// A content of exclude.txt file that is passed to tempest via --exclude-list
ExcludeList *string `json:"excludeList,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// The expected_failures.txt file contains tests that should not count
// as failures for the job, as they are expected to fail.
ExpectedFailuresList *string `json:"expectedFailuresList,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Concurrency value that is passed to tempest via --concurrency
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions config/crd/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ spec:
description: A content of exclude.txt file that is passed to tempest
via --exclude-list
type: string
expectedFailuresList:
description: The expected_failures.txt file contains tests that
should not count as failures for the job, as they are expected
to fail.
type: string
externalPlugin:
description: ExternalPlugin contains information about plugin
that should be installed within the tempest test pod. If this
Expand Down Expand Up @@ -603,6 +608,11 @@ spec:
description: A content of exclude.txt file that is passed
to tempest via --exclude-list
type: string
expectedFailuresList:
description: The expected_failures.txt file contains tests
that should not count as failures for the job, as they
are expected to fail.
type: string
externalPlugin:
description: ExternalPlugin contains information about plugin
that should be installed within the tempest test pod.
Expand Down
2 changes: 2 additions & 0 deletions config/samples/test_v1beta1_tempest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
concurrency: 8
# excludeList: | # <-- Use | to preserve \n
# tempest.api.identity.v3.*
# expectedFailuresList: | # <-- Use | to preserve \n
# tempest.api.identity.v3.*
# workerFile: | # <-- Use | to preserve \n
# - worker:
# - tempest.api.*
Expand Down
7 changes: 7 additions & 0 deletions controllers/tempest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,13 @@ func (r *TempestReconciler) setTempestConfigVars(envVars map[string]string,
envVars["TEMPEST_EXCLUDE_LIST"] = testOperatorDir + excludeListFile
}

value = mergeWithWorkflow(tRun.ExpectedFailuresList, wtRun.ExpectedFailuresList)
if len(value) != 0 {
expectedFailuresListFile := "expected_failures.txt"
customData[expectedFailuresListFile] = value
envVars["TEMPEST_EXPECTED_FAILURES_LIST"] = testOperatorDir + expectedFailuresListFile
}

// Bool
tempestBoolEnvVars := map[string]bool{
"TEMPEST_SERIAL": mergeWithWorkflow(tRun.Serial, wtRun.Serial),
Expand Down

0 comments on commit 4e87034

Please sign in to comment.