第 2 章 使用 Test Operator 运行 Tempest 测试
使用 Tempest 测试时,请使用 OpenShift (RHOSO) test-operator 上的 Red Hat OpenStack Services。
先决条件
- 已部署 RHOSO 环境。
确保您位于 OpenStack 项目中:
oc project openstack
$ oc project openstack Now using project "openstack" on server "https://api.crc.testing:6443".Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1. tempest 自定义资源配置文件 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
此 test-v1beta1-tempest.yaml 文件是一个 Tempest 自定义资源(CR)示例,您可以编辑并使用 test-operator 执行 Tempest 测试。
apiVersion: test.openstack.org/v1beta1
kind: Tempest
metadata:
name: tempest-tests
namespace: openstack
spec:
containerImage: ""
# storageClass: local-storage
# parallel: false
# debug: false
# configOverwrite
# ---------------
# An interface to overwrite default config files like e.g. logging.conf But can also
# be used to add additional files. Those get added to the service config dir in
# /etc/test_operator/<file>
#
# configOverwrite:
# file.txt: |
# content of the file
# SSHKeySecretName
# ----------------
# SSHKeySecretName is the name of the k8s secret that contains an ssh key. The key is
# mounted to ~/.ssh/id_ecdsa in the tempest pod. Note, the test-operator looks for
# the private key in ssh-privatekey field of the secret.
#
# SSHKeySecretName: secret_name
# Privileged
# ----------
# Use the privileged parameter with caution! This parameter specifies if test-operator
# spawns test pods with allowedPrivilegedEscalation: true, readOnlyRootFilesystem: false,
# runAsNonRoot: false, automountServiceAccountToken: true, and the default
# capabilities on top of capabilities that are usually needed by the test
# pods (NET_ADMIN, NET_RAW). Setting the privileged parameter to true can decrease
# security, but is necessary for specific test-operator functionalities,
# such as extraRPMs in Tempest CR, or some set tobiko tests.
# privileged: false
tempestRun:
# NOTE: All parameters have default values (use only when you want to override
# the default behaviour)
includeList: | # <-- Use | to preserve \n
tempest.api.identity.v3.*
concurrency: 8
# excludeList: | # <-- Use | to preserve \n
# tempest.api.identity.v3.*
# workerFile: | # <-- Use | to preserve \n
# - worker:
# - tempest.api.*
# - neutron_tempest_tests
# - worker:
# - tempest.scenario.*
# smoke: false
# serial: false
# parallel: true
# externalPlugin:
# - repository: "https://opendev.org/openstack/barbican-tempest-plugin.git"
# - repository: "https://opendev.org/openstack/neutron-tempest-plugin.git"
# changeRepository: "https://review.opendev.org/openstack/neutron-tempest-plugin"
# changeRefspec: "refs/changes/97/896397/2"
# extraImages:
# - URL: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img
# name: cirros-0.6.2-test-operator
# flavor:
# name: cirros-0.6.2-test-operator-flavor
# RAM: 512
# disk: 20
# vcpus: 1
# extraRPMs:
# ----------
# A list of URLs that point to RPMs that should be installed before
# the execution of tempest. WARNING! This parameter has no efect when used
# in combination with externalPlugin parameter.
# extraRPMs:
# - https://cbs.centos.org/kojifiles/packages/python-sshtunnel/0.4.0/12.el9s/noarch/python3-sshtunnel-0.4.0-12.el9s.noarch.rpm
# - https://cbs.centos.org/kojifiles/packages/python-whitebox-tests-tempest/0.0.3/0.1.766ff04git.el9s/noarch/python3-whitebox-tests-tempest-0.0.3-0.1.766ff04git.el9s.noarch.rpm
tempestconfRun:
# NOTE: All parameters have default values (use only when you want to override
# the default behaviour)
# create: true
# collectTiming: false
# insecure: false
# noDefaultDeployer: false
# debug: false
# verbose: false
# nonAdmin: false
# retryImage: false
# convertToRaw: false
# out: ./etc/tempest.conf
# flavorMinMem: 128
# flavorMinDisk: 1
# timeout: 600
# imageDiskFormat: qcow2
# image: https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
# The following text will be mounted to the tempest pod
# as /etc/test_operator/deployer_input.yaml
# deployerInput: |
# [section]
# value1 = exmaple_value2
# value2 = example_value2
# The following text will be mounted to the tempest pod
# as /etc/test_operator/accounts.yaml
# testAccounts: |
# - username: 'multi_role_user'
# tenant_name: 'test_tenant_42'
# password: 'test_password'
# roles:
# - 'fun_role'
# - 'not_an_admin'
# - 'an_admin'
# The following text will be mounted to the tempest pod
# as /etc/test_operator/profile.yaml
# profile: |
# collect_timing: false
# create: false
# create_accounts_file: null
# createAccountsFile: /path/to/accounts.yaml
# generateProfile: /path/to/profile.yaml
# networkID:
# append: | # <-- Use | to preserve \n
# section1.name1 value1
# section1.name1 value2
# remove: | # <-- Use | to preserve \n
# section1.name1 value1
# section1.name1 value2
# overrides: | # <-- Use | to preserve \n
# overrides_section1.name1 value1
# overrides_section1.name1 value2
# Workflow
# --------
# Workflow section can be utilized to spawn multiple test pods at the same time.
# The commented out example spawns two test pods that are executed sequentially.
# Each step inherits all configuration that is specified outside of the workflow
# field. For each step you can overwrite values specified in the tempestRun and
# tempestconfRun sections.
#
# workflow:
# - stepName: firstStep
# tempestRun:
# includeList: |
# tempest.api.*
# - stepName: secondStep
# tempestRun:
# includeList: |
# neutron_tempest_plugin.*
apiVersion: test.openstack.org/v1beta1
kind: Tempest
metadata:
name: tempest-tests
namespace: openstack
spec:
containerImage: ""
# storageClass: local-storage
# parallel: false
# debug: false
# configOverwrite
# ---------------
# An interface to overwrite default config files like e.g. logging.conf But can also
# be used to add additional files. Those get added to the service config dir in
# /etc/test_operator/<file>
#
# configOverwrite:
# file.txt: |
# content of the file
# SSHKeySecretName
# ----------------
# SSHKeySecretName is the name of the k8s secret that contains an ssh key. The key is
# mounted to ~/.ssh/id_ecdsa in the tempest pod. Note, the test-operator looks for
# the private key in ssh-privatekey field of the secret.
#
# SSHKeySecretName: secret_name
# Privileged
# ----------
# Use the privileged parameter with caution! This parameter specifies if test-operator
# spawns test pods with allowedPrivilegedEscalation: true, readOnlyRootFilesystem: false,
# runAsNonRoot: false, automountServiceAccountToken: true, and the default
# capabilities on top of capabilities that are usually needed by the test
# pods (NET_ADMIN, NET_RAW). Setting the privileged parameter to true can decrease
# security, but is necessary for specific test-operator functionalities,
# such as extraRPMs in Tempest CR, or some set tobiko tests.
# privileged: false
tempestRun:
# NOTE: All parameters have default values (use only when you want to override
# the default behaviour)
includeList: | # <-- Use | to preserve \n
tempest.api.identity.v3.*
concurrency: 8
# excludeList: | # <-- Use | to preserve \n
# tempest.api.identity.v3.*
# workerFile: | # <-- Use | to preserve \n
# - worker:
# - tempest.api.*
# - neutron_tempest_tests
# - worker:
# - tempest.scenario.*
# smoke: false
# serial: false
# parallel: true
# externalPlugin:
# - repository: "https://opendev.org/openstack/barbican-tempest-plugin.git"
# - repository: "https://opendev.org/openstack/neutron-tempest-plugin.git"
# changeRepository: "https://review.opendev.org/openstack/neutron-tempest-plugin"
# changeRefspec: "refs/changes/97/896397/2"
# extraImages:
# - URL: https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img
# name: cirros-0.6.2-test-operator
# flavor:
# name: cirros-0.6.2-test-operator-flavor
# RAM: 512
# disk: 20
# vcpus: 1
# extraRPMs:
# ----------
# A list of URLs that point to RPMs that should be installed before
# the execution of tempest. WARNING! This parameter has no efect when used
# in combination with externalPlugin parameter.
# extraRPMs:
# - https://cbs.centos.org/kojifiles/packages/python-sshtunnel/0.4.0/12.el9s/noarch/python3-sshtunnel-0.4.0-12.el9s.noarch.rpm
# - https://cbs.centos.org/kojifiles/packages/python-whitebox-tests-tempest/0.0.3/0.1.766ff04git.el9s/noarch/python3-whitebox-tests-tempest-0.0.3-0.1.766ff04git.el9s.noarch.rpm
tempestconfRun:
# NOTE: All parameters have default values (use only when you want to override
# the default behaviour)
# create: true
# collectTiming: false
# insecure: false
# noDefaultDeployer: false
# debug: false
# verbose: false
# nonAdmin: false
# retryImage: false
# convertToRaw: false
# out: ./etc/tempest.conf
# flavorMinMem: 128
# flavorMinDisk: 1
# timeout: 600
# imageDiskFormat: qcow2
# image: https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
# The following text will be mounted to the tempest pod
# as /etc/test_operator/deployer_input.yaml
# deployerInput: |
# [section]
# value1 = exmaple_value2
# value2 = example_value2
# The following text will be mounted to the tempest pod
# as /etc/test_operator/accounts.yaml
# testAccounts: |
# - username: 'multi_role_user'
# tenant_name: 'test_tenant_42'
# password: 'test_password'
# roles:
# - 'fun_role'
# - 'not_an_admin'
# - 'an_admin'
# The following text will be mounted to the tempest pod
# as /etc/test_operator/profile.yaml
# profile: |
# collect_timing: false
# create: false
# create_accounts_file: null
# createAccountsFile: /path/to/accounts.yaml
# generateProfile: /path/to/profile.yaml
# networkID:
# append: | # <-- Use | to preserve \n
# section1.name1 value1
# section1.name1 value2
# remove: | # <-- Use | to preserve \n
# section1.name1 value1
# section1.name1 value2
# overrides: | # <-- Use | to preserve \n
# overrides_section1.name1 value1
# overrides_section1.name1 value2
# Workflow
# --------
# Workflow section can be utilized to spawn multiple test pods at the same time.
# The commented out example spawns two test pods that are executed sequentially.
# Each step inherits all configuration that is specified outside of the workflow
# field. For each step you can overwrite values specified in the tempestRun and
# tempestconfRun sections.
#
# workflow:
# - stepName: firstStep
# tempestRun:
# includeList: |
# tempest.api.*
# - stepName: secondStep
# tempestRun:
# includeList: |
# neutron_tempest_plugin.*
警告
请谨慎使用 privileged 参数。true 值可以创建安全漏洞。