Add sleeps to make test non-flaky
Sucks, but MySQL only has second-level timing, so we need this to be sure
This commit is contained in:
		
							parent
							
								
									103186f5e8
								
							
						
					
					
						commit
						541aa722c2
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -1,4 +1,5 @@ | |||
| from datetime import timedelta | ||||
| import time | ||||
| 
 | ||||
| import pytest | ||||
| 
 | ||||
|  | @ -210,6 +211,8 @@ def test_sync_teams_to_groups(app): | |||
| 
 | ||||
|   # Call to sync all teams. | ||||
|   fake_auth = FakeUsers([]) | ||||
| 
 | ||||
|   time.sleep(1) | ||||
|   sync_teams_to_groups(fake_auth, timedelta(seconds=1)) | ||||
| 
 | ||||
|   # Ensure the team was synced. | ||||
|  | @ -218,13 +221,15 @@ def test_sync_teams_to_groups(app): | |||
|   assert updated_sync_info.transaction_id != sync_team_info.transaction_id | ||||
| 
 | ||||
|   # Set the stale threshold to a high amount and ensure the team is not resynced. | ||||
|   time.sleep(1) | ||||
|   sync_teams_to_groups(fake_auth, timedelta(seconds=120)) | ||||
| 
 | ||||
|   third_sync_info = model.team.get_team_sync_information('buynlarge', 'synced') | ||||
|   assert third_sync_info.last_updated == updated_sync_info.last_updated | ||||
|   assert third_sync_info.transaction_id == updated_sync_info.transaction_id | ||||
| 
 | ||||
|   # Set the stale threshold to -10 seconds, and ensure the team is resynced. | ||||
|   # Set the stale threshold to -120 seconds, and ensure the team is resynced. | ||||
|   time.sleep(1) | ||||
|   sync_teams_to_groups(fake_auth, timedelta(seconds=-120)) | ||||
| 
 | ||||
|   fourth_sync_info = model.team.get_team_sync_information('buynlarge', 'synced') | ||||
|  |  | |||
		Reference in a new issue