Skip to content

Commit

Permalink
Remove TempestRegexp argument
Browse files Browse the repository at this point in the history
Looks like it was not in use since the begning.
Users usually finds simpler to have explicit negative list,
even tough it is possible to consutuct a singe regexp.
Also possible to construct a single regexp on the operator side,
in case other way of passing would be prefered later on.

Moving the default allowedTests to the defaults.

Note: Consider moving the tempest run arguments
to sub structure.
  • Loading branch information
afazekas committed Sep 20, 2023
1 parent f60e80d commit 34deecb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
5 changes: 2 additions & 3 deletions api/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
description: TempestSpec defines the desired state of Tempest
properties:
allowedTests:
default:
- tempest.api.identity.v3
description: AllowedTests
items:
type: string
Expand Down Expand Up @@ -119,9 +121,6 @@ spec:
items:
type: string
type: array
tempestRegex:
description: TempestRegex
type: string
required:
- containerImage
- openStackConfigMap
Expand Down
5 changes: 1 addition & 4 deletions api/v1beta1/tempest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ type TempestSpec struct {
ExternalEndpoints []MetalLBConfig `json:"externalEndpoints,omitempty"`

// +kubebuilder:validation:Optional
// TempestRegex
TempestRegex string `json:"tempestRegex,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={"tempest.api.identity.v3"}
// AllowedTests
AllowedTests []string `json:"allowedTests,omitempty"`

Expand Down
5 changes: 2 additions & 3 deletions config/crd/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
description: TempestSpec defines the desired state of Tempest
properties:
allowedTests:
default:
- tempest.api.identity.v3
description: AllowedTests
items:
type: string
Expand Down Expand Up @@ -119,9 +121,6 @@ spec:
items:
type: string
type: array
tempestRegex:
description: TempestRegex
type: string
required:
- containerImage
- openStackConfigMap
Expand Down
14 changes: 3 additions & 11 deletions pkg/tempest/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ func Job(
runAsUser := int64(42480)
runAsGroup := int64(42480)

args := []string{
"/var/lib/tempest/run_tempest.sh",
}
if instance.Spec.TempestRegex != "" {
args = append(args, "--regex")
args = append(args, instance.Spec.TempestRegex)
}

job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name,
Expand All @@ -40,9 +32,9 @@ func Job(
RestartPolicy: corev1.RestartPolicyNever,
ServiceAccountName: instance.RbacResourceName(),
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: &runAsUser,
RunAsUser: &runAsUser,
RunAsGroup: &runAsGroup,
FSGroup: &runAsGroup,
FSGroup: &runAsGroup,
},
Containers: []corev1.Container{
{
Expand All @@ -51,7 +43,7 @@ func Job(
Command: []string{
"/usr/local/bin/container-scripts/invoke_tempest",
},
Args: []string{},
Args: []string{},
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
VolumeMounts: GetVolumeMounts(),
},
Expand Down
2 changes: 0 additions & 2 deletions templates/tempest/config/include.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{range $val := .AllowedTests }}
{{$val}}
{{ else }}
tempest.api.identity.v3
{{end}}

0 comments on commit 34deecb

Please sign in to comment.