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

Sleep mode for scenarios #1794

Merged
merged 3 commits into from
Nov 7, 2023
Merged

Conversation

robertomonteromiguel
Copy link
Collaborator

Description

Enable sleep mode for different scenarios

Motivation

Workflow

  1. ⚠️⚠️ Create your PR as draft
  2. Follow the style guidelines of this project (See how to easily lint the code)
  3. Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
  4. Mark it as ready for review

Once your PR is reviewed, you can merge it! ❤️

Reviewer checklist

  • Check what scenarios are modified. If needed, add the relevant label (run-parametric-scenario, run-profiling-scenario...). If this PR modifies any system-tests internal, then add the run-all-scenarios label (more info).
  • CI is green
    • If not, failing jobs are not related to this change (and you are 100% sure about this statement)
  • if any of build-some-image label is present
    1. is the image labl have been updated ?
    2. just before merging, locally build and push the image to hub.docker.com
  • if a scenario is added (or removed), add (or remove) it in system-test-dasboard nightly

@robertomonteromiguel robertomonteromiguel marked this pull request as ready for review November 3, 2023 16:14
@robertomonteromiguel robertomonteromiguel requested a review from a team as a code owner November 3, 2023 16:14
Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

By which wizardry it actually sleeps ?

Also, could you remove the sleep scenario in _scenarios.py ?

@robertomonteromiguel
Copy link
Collaborator Author

By which wizardry it actually sleeps ?

Also, could you remove the sleep scenario in _scenarios.py ?

if the option --sleep is set, in the method "pytest_collection_modifyitems" we are deselecting the tests/items associated with the real scenario (ie INTEGRATIONS) and adding "SLEEP" scenario items. So I think , in this way we can't remove the sleep scenario

@cbeauchesne
Copy link
Collaborator

Ah, ok !

I think we could to this a little bit better : in pytest_collection_finish, commented lines are from me :

    if session.config.option.collectonly:
        return
    
    if session.config.option.sleep:  # on this mode, we simply sleep, not running any test or setup
        try:
            logger.terminal("Sleep mode activated. Press Ctrl+C to exit")
            while True:  # inifinite sleep
                 sleep(1):   # arbitrary amount 
        except KeyboardInterrupt:   # catching ctrl+C
             pass
        finally:   # in case of other error
              pytest.exit(0). # exit in sucess

And then, we can remove the sleep scenario :)

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

Again a small leftover in _scneario.py to remove : the sleep scenario instance.

@robertomonteromiguel
Copy link
Collaborator Author

Again a small leftover in _scneario.py to remove : the sleep scenario instance.

Uppss! Done!

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

You should communicate this on apm-shared-testing 🎉

@robertomonteromiguel robertomonteromiguel merged commit f8e3f4d into main Nov 7, 2023
@robertomonteromiguel robertomonteromiguel deleted the robertomonteromiguel/sleep_mode branch November 7, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants