Skip to content

Commit

Permalink
Add support for external plugins
Browse files Browse the repository at this point in the history
This patch ensures that the test operator takes advantage of the new
parameters of the tempest container:
    - TEMPEST_EXTERNAL_PLUGIN_GIT_URL
    - TEMPEST_EXTERNAL_PLUGIN_CHANGE_URL
    - TEMPEST_EXTERNAL_PLUGIN_REFSPEC

The user can use this parameters by specifying the following values
for the Tempest CR:
    - externalPluginGitURL
    - externalPluginChangeURL
    - externalPluginRefspec
  • Loading branch information
lpiwowar committed Nov 24, 2023
1 parent 4a224bc commit adfa194
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 1 deletion.
24 changes: 24 additions & 0 deletions api/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ spec:
default: ""
description: ExcludeList
type: string
externalPluginChangeURL:
description: ExternalPluginChangeURL should be used together with
ExternalPluginsRefspec. These two variables specify which changes
should be download from gerrit/github for each downloaded plugin
(see ExternalPluginGitURL). Both variables are arrays.
items:
type: string
type: array
externalPluginGitURL:
description: ExternalPluginGitURL is an array of URLs that point
to git repositories containing tempest plugins that should be
installed within the tempest container. If this option is specified
then only tests from the external plugins are executed.
items:
type: string
type: array
externalPluginRefspec:
description: ExternalPluginRefspec should be used together with
ExternalPluginsRefspecs. These two variables specify which changes
should be download from gerrit/github for each downloaded plugin
(see ExternalPluginGitURL). Both variables are arrays.
items:
type: string
type: array
includeList:
default: tempest.api.identity.v3
description: IncludeList
Expand Down
21 changes: 21 additions & 0 deletions api/v1beta1/tempest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ type TempestRunSpec struct {
// +kubebuilder:default:=""
// WorkerFile is the detailed concurrency spec file
WorkerFile string `json:"workerFile,omitempty"`

// +kubebuilder:validation:Optional
// ExternalPluginGitURL is an array of URLs that point
// to git repositories containing tempest plugins that should be
// installed within the tempest container. If this option is
// specified then only tests from the external plugins are executed.
ExternalPluginGitURL []string `json:"externalPluginGitURL,omitempty"`

// +kubebuilder:validation:Optional
// ExternalPluginChangeURL should be used together with
// ExternalPluginsRefspec. These two variables specify which changes
// should be download from gerrit/github for each downloaded plugin
// (see ExternalPluginGitURL). Both variables are arrays.
ExternalPluginChangeURL []string `json:"externalPluginChangeURL,omitempty"`

// +kubebuilder:validation:Optional
// ExternalPluginRefspec should be used together with
// ExternalPluginsRefspecs. These two variables specify which changes
// should be download from gerrit/github for each downloaded plugin
// (see ExternalPluginGitURL). Both variables are arrays.
ExternalPluginRefspec []string `json:"externalPluginRefspec,omitempty"`
}

// TempestSpec PythonTempestconf parts
Expand Down
17 changes: 16 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

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

24 changes: 24 additions & 0 deletions config/crd/bases/test.openstack.org_tempests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ spec:
default: ""
description: ExcludeList
type: string
externalPluginChangeURL:
description: ExternalPluginChangeURL should be used together with
ExternalPluginsRefspec. These two variables specify which changes
should be download from gerrit/github for each downloaded plugin
(see ExternalPluginGitURL). Both variables are arrays.
items:
type: string
type: array
externalPluginGitURL:
description: ExternalPluginGitURL is an array of URLs that point
to git repositories containing tempest plugins that should be
installed within the tempest container. If this option is specified
then only tests from the external plugins are executed.
items:
type: string
type: array
externalPluginRefspec:
description: ExternalPluginRefspec should be used together with
ExternalPluginsRefspecs. These two variables specify which changes
should be download from gerrit/github for each downloaded plugin
(see ExternalPluginGitURL). Both variables are arrays.
items:
type: string
type: array
includeList:
default: tempest.api.identity.v3
description: IncludeList
Expand Down
5 changes: 5 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/openstack-k8s-operators/test-operator-index
9 changes: 9 additions & 0 deletions config/samples/test_v1beta1_tempest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ spec:
# smoke: false
# serial: false
# parallel: true
# externalPluginGitURL:
# - "https://opendev.org/openstack/barbican-tempest-plugin.git"
# - "https://opendev.org/openstack/neutron-tempest-plugin.git"
# externalPluginChangeURL:
# - "-"
# - "https://review.opendev.org/openstack/neutron-tempest-plugin"
# externalPluginRefspec:
# - "-"
# - "refs/changes/97/896397/2"
tempestconfRun:
# NOTE: All parameters have default values (use only when you want to override
# the default behaviour)
Expand Down
13 changes: 13 additions & 0 deletions controllers/tempest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,19 @@ func setTempestConfigVars(envVars map[string]string,

// Int
envVars["TEMPEST_CONCURRENCY"] = getDefaultInt(tempestRun.Concurrency)

// Arrays
for _, value := range tempestRun.ExternalPluginGitURL {
envVars["TEMPEST_EXTERNAL_PLUGIN_GIT_URL"] += value + ","
}

for _, value := range tempestRun.ExternalPluginChangeURL {
envVars["TEMPEST_EXTERNAL_PLUGIN_CHANGE_URL"] = value + ","
}

for _, value := range tempestRun.ExternalPluginRefspec {
envVars["TEMPEST_EXTERNAL_PLUGIN_REFSPEC"] = value + ","
}
}

func setTempestconfConfigVars(envVars map[string]string,
Expand Down
3 changes: 3 additions & 0 deletions docs/source/samples/tempest-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ data:
# TEMPEST_SMOKE: true
# TEMPEST_PARALLEL: true
# TEMPEST_SERIAL: true
# TEMPEST_EXTERNAL_PLUGIN_GIT_URL: "https://opendev.org/openstack/barbican-tempest-plugin.git,https://opendev.org/openstack/neutron-tempest-plugin.git"
# TEMPEST_EXTERNAL_PLUGIN_CHANGE_URL: "-,https://review.opendev.org/openstack/neutron-tempest-plugin"
# TEMPEST_EXTERNAL_PLUGIN_REFSPEC: "-,refs/changes/97/896397/2"

# TEMPESTCONF env variables:
# --------------------------
Expand Down

0 comments on commit adfa194

Please sign in to comment.