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

{CI} Fix top N slowest Test #21880

Merged
merged 5 commits into from
Apr 12, 2022
Merged

Conversation

wangzelin007
Copy link
Member

@wangzelin007 wangzelin007 commented Mar 31, 2022

Description

This PR will speed up our test.

  • Our list command is not pagination, it will get all the data.
    That is why some recording files are very large.
    And in test_show_built_in_policy, we choose to check the first resource instead of check all the resource to speed up.

  • We only mock time.sleep in azure-sdk-tools.
    That's why if someone use sleep(xxx), it will not work.

    mock_in_unit_test(unit_test, 'time.sleep', _time_sleep_skip)

Profile Test Case Before After Total saving time
Latest test_show_built_in_policy 536.57s 2.94s
2019-03-01 test_show_built_in_policy 210.69s 3.01s
Latest test_sql_db_restore 305.01s 8.70s
Latest test_sql_db_restore_deleted 184.63s 7.39s
Latest test_postgrsql_general_purpose_replica_mgmt 121.76s 4.11s
Latest test_sql_tde 10.54s 3.03s
Latest test_sql_ledger 7.62s 3.00s
Total 1,344.64s

image

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost added Auto-Assign Auto assign by bot CI CI labels Mar 31, 2022
@ghost ghost requested review from yonzhan, jiasli and kairu-ms March 31, 2022 06:51
@ghost ghost assigned wangzelin007 Mar 31, 2022
@ghost ghost added this to the Apr 2022 (2022-04-26) milestone Mar 31, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 31, 2022

CI

@wangzelin007 wangzelin007 marked this pull request as ready for review April 11, 2022 07:34
@wangzelin007 wangzelin007 changed the title {CI} Test speed up {CI} Fix top N slowest Test Apr 11, 2022
@@ -1326,7 +1326,7 @@ def _create_db_wait_for_first_backup(test, resource_group, server, database_name
# Wait until earliestRestoreDate is in the past. When run live, this will take at least
# 10 minutes. Unforunately there's no way to speed this up
while db['earliestRestoreDate'] is None:
sleep(60)
time.sleep(60)
Copy link
Member

Choose a reason for hiding this comment

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

from time import sleep can now be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need modify these codes before remove from time import sleep.
I think add if self.is_live condition is also acceptable.


if self.is_live:
self.assertTrue(datetime.now() < start_time + timeout, 'Deleted db not found before timeout expired.')
sleep(10) # seconds






Copy link
Member

Choose a reason for hiding this comment

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

Let's only remove from time import sleep when it is not used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot CI CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants