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 cache before run pytest in run_tests.sh #3132

Merged
merged 1 commit into from
Mar 15, 2021
Merged

Cleanup cache before run pytest in run_tests.sh #3132

merged 1 commit into from
Mar 15, 2021

Conversation

wangxin
Copy link
Collaborator

@wangxin wangxin commented Mar 12, 2021

Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

Only really less frequently changed content is cached. Although It is rare that cached content is inaccurate, it still could happen. Then it would be difficult to debug.

How did you do it?

This change added code in run_tests.sh to cleanup cache before running pytest. Without cached
content, executing the first script may need extra time to gather facts again, but executing
subsequent scripts still can benefit from content cached while executing the first script.

How did you verify/test it?

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

Only really less frequently changed content is cached. Although It is rare that cached content is inaccurate, it still could happen. Then it would be difficult to debug.

This change added code in run_tests.sh to cleanup cache before running pytest. Without cached
content, executing the first script may need extra time to gather facts again, but executing
subsequent scripts still can benefit from content cached while executing the first script.

Signed-off-by: Xin Wang <[email protected]>
@wangxin wangxin requested a review from a team March 12, 2021 06:13
@@ -90,6 +90,8 @@ function setup_environment()
export ANSIBLE_CONFIG=${BASE_PATH}/ansible
export ANSIBLE_LIBRARY=${BASE_PATH}/ansible/library/
export ANSIBLE_CONNECTION_PLUGINS=${BASE_PATH}/ansible/plugins/connection

rm -fr ${BASE_PATH}/tests/_cache
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking about add logs to the decorator cached to make test user aware of where the facts come from(cached or function call).

@wangxin
Copy link
Collaborator Author

wangxin commented Mar 12, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin
Copy link
Collaborator Author

wangxin commented Mar 15, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin wangxin merged commit b0bebd5 into sonic-net:master Mar 15, 2021
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.

3 participants