Skip to content

{CI} Fix top N slowest Test#21880

Merged
wangzelin007 merged 5 commits intoAzure:devfrom
wangzelin007:fix_top_n_slowest_test
Apr 12, 2022
Merged

{CI} Fix top N slowest Test#21880
wangzelin007 merged 5 commits intoAzure:devfrom
wangzelin007:fix_top_n_slowest_test

Conversation

@wangzelin007
Copy link
Copy Markdown
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 jiasli, kairu-ms and yonzhan 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
Copy Markdown
Collaborator

yonzhan commented Mar 31, 2022

CI

@wangzelin007 wangzelin007 force-pushed the fix_top_n_slowest_test branch from 93f68e9 to ced4800 Compare April 11, 2022 07:06
@wangzelin007 wangzelin007 force-pushed the fix_top_n_slowest_test branch from ced4800 to 92e4524 Compare April 11, 2022 07:21
@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
# 10 minutes. Unforunately there's no way to speed this up
while db['earliestRestoreDate'] is None:
sleep(60)
time.sleep(60)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@wangzelin007 wangzelin007 requested a review from necusjz April 12, 2022 09:04
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