Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tempest related resources after testing #208

Merged

Conversation

kopecmartin
Copy link
Contributor

Let's run tempest cleanup after the tempest run, unless debug mode is enabled, to delete any leftover resources (from the tempest run) so that they won't disrupt any further testing - testing frameworks executed after tempest.

@openshift-ci openshift-ci bot requested review from rabi and son-vyas September 9, 2024 07:48
@kopecmartin kopecmartin requested a review from lpiwowar September 9, 2024 07:48
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will run tempest cleanup at the end of execution of each test pod. This means that we are going to be downloading and uploading images each time a new pod is spawned (after the necessary fix I proposed).

Meaning, if there are 3 workflow steps we are going to be downloading and deleting image 3 times. Considering that some of the images are big it would be waste of time (we are talking 15 mins per download).

Here are two things that we could do:

  • Modify this patch so that the cleanup behavior can be turned on / off through env variable (default off)
  • Allow setting this parameter through Tempest CR and test_operator role.

container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/tcib for 208,68d76c22fed383606daf3ea5d6a0234db5b0caf2

@kopecmartin kopecmartin force-pushed the tempest_cleanup branch 2 times, most recently from e0dff7b to f37dab7 Compare September 12, 2024 08:32
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tempet cleanup command is failing on missing credentials:

+ tempest cleanup --init-saved-state
Failure during cleanup
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/tempest/cmd/cleanup.py", line 153, in take_action
    self.init(parsed_args)
  File "/usr/lib/python3.9/site-packages/tempest/cmd/cleanup.py", line 183, in init
    credentials.get_configured_admin_credentials())
  File "/usr/lib/python3.9/site-packages/tempest/common/credentials_factory.py", line 257, in get_configured_admin_credentials
    credentials = get_credentials(fill_in=fill_in,
  File "/usr/lib/python3.9/site-packages/tempest/common/credentials_factory.py", line 300, in get_credentials
    return auth.get_credentials(auth_url,
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 649, in get_credentials
    auth_provider = auth_provider_class(
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 263, in __init__
    super(KeystoneAuthProvider, self).__init__(credentials, scope)
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 91, in __init__
    raise exceptions.InvalidCredentials(message)
tempest.lib.exceptions.InvalidCredentials: Invalid Credentials
Details: Credentials are: {'domain_id': None, 'domain_name': 'Default', 'username': None, 'project_domain_id': None, 'project_domain_name': 'Default', 'project_id': None, 'project_name': None, 'tenant_id': None, 'tenant_name': None, 'user_domain_id': None, 'user_domain_name': 'Default', 'user_id': None, 'system': None} Password is not defined.
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/tempest/cmd/cleanup.py", line 153, in take_action
    self.init(parsed_args)
  File "/usr/lib/python3.9/site-packages/tempest/cmd/cleanup.py", line 183, in init
    credentials.get_configured_admin_credentials())
  File "/usr/lib/python3.9/site-packages/tempest/common/credentials_factory.py", line 257, in get_configured_admin_credentials
    credentials = get_credentials(fill_in=fill_in,
  File "/usr/lib/python3.9/site-packages/tempest/common/credentials_factory.py", line 300, in get_credentials
    return auth.get_credentials(auth_url,
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 649, in get_credentials
    auth_provider = auth_provider_class(
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 263, in __init__
    super(KeystoneAuthProvider, self).__init__(credentials, scope)
  File "/usr/lib/python3.9/site-packages/tempest/lib/auth.py", line 91, in __init__
    raise exceptions.InvalidCredentials(message)
tempest.lib.exceptions.InvalidCredentials: Invalid Credentials

and

+ '[' false == false
/var/lib/tempest/run_tempest.sh: line 368: [: missing `]'

[1] https://logserver.rdoproject.org/08/208/f37dab74dbbd7d4cc910377ebf5f9d9a55965b6f/github-check/tcib-podified-multinode-edpm-deployment-crc/348e9cb/controller/ci-framework-data/logs/openstack-k8s-operators-openstack-must-gather/namespaces/openstack/pods/tempest-tests-xcclp/logs/tempest-tests-tests-runner.log

container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/0f0d572ed4af4194a98fbeecbd311ec5

✔️ openstack-meta-content-provider SUCCESS in 2h 28m 18s
✔️ tcib-crc-podified-edpm-baremetal SUCCESS in 1h 31m 51s
tcib-podified-multinode-edpm-deployment-crc FAILURE in 1h 07m 15s

@lpiwowar
Copy link
Contributor

lpiwowar commented Sep 13, 2024

Missing brackets:

/var/lib/tempest/run_tempest.sh: line 332: syntax error in conditional expression
/var/lib/tempest/run_tempest.sh: line 332: syntax error near `]'
/var/lib/tempest/run_tempest.sh: line 332: `    if [[ ${TEMPEST_DEBUG_MODE} == false ] && [ ${TEMPEST_CLEANUP} == true ]]; then'
[[ ${TEMPEST_DEBUG_MODE} == false ]] && [[ ${TEMPEST_CLEANUP} == true ]]

(I missed the brackets in the comment above)

(Note I'm not sure whether this PR contains fix for the missing credentials error mentioned in the previous comment).

https://logserver.rdoproject.org/08/208/397e41e9f860c3ebd7c4cda8f815093082494044/github-check/tcib-podified-multinode-edpm-deployment-crc/fd60b56/controller/ci-framework-data/logs/openstack-k8s-operators-openstack-must-gather/namespaces/openstack/pods/tempest-tests-fjxr8/logs/tempest-tests-tests-runner.log

@kopecmartin
Copy link
Contributor Author

oh, the creds error is related to the fact that now we run 'tempest cleanup' before we have a tempest.conf .. we need to run discover-tempest-config first

@lpiwowar
Copy link
Contributor

oh, the creds error is related to the fact that now we run 'tempest cleanup' before we have a tempest.conf .. we need to run discover-tempest-config first

We have to find either:

  • how to run tempest cleanup first or
  • how to ensure that the resources created by discover-tempest-config (especially cirros image) get cleaned up.

@kopecmartin kopecmartin force-pushed the tempest_cleanup branch 2 times, most recently from 09fecf1 to 90d23e1 Compare September 16, 2024 09:39
@kopecmartin
Copy link
Contributor Author

done, the easier way will be to generate a simple tempest.conf containing basically the default settings

Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question.

@kopecmartin kopecmartin force-pushed the tempest_cleanup branch 2 times, most recently from ce710bb to 30197fb Compare September 19, 2024 14:11
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

I've just added one comment. What do you think @kopecmartin?

container-images/tcib/base/os/tempest/run_tempest.sh Outdated Show resolved Hide resolved
Let's run tempest cleanup after the tempest run if TEMPEST_CLEANUP
is set to true (false by default and debug mode is not enabled,
to delete any leftover resources (from the tempest run) so that
they won't disrupt any further testing - testing frameworks
executed after tempest.
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

@openshift-ci openshift-ci bot added the lgtm label Sep 23, 2024
Copy link
Contributor

openshift-ci bot commented Sep 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: ashu-011, kopecmartin, lpiwowar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 41545a5 into openstack-k8s-operators:main Sep 25, 2024
5 checks passed
kopecmartin added a commit to kopecmartin/ci-framework that referenced this pull request Sep 25, 2024
Allow users to enable tempest cleanup feature defined in the tempest image.

openstack-k8s-operators/tcib#208
openstack-k8s-operators/test-operator#207
openshift-merge-bot bot pushed a commit to openstack-k8s-operators/ci-framework that referenced this pull request Oct 3, 2024
Allow users to enable tempest cleanup feature defined in the tempest image.

openstack-k8s-operators/tcib#208
openstack-k8s-operators/test-operator#207
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants