Skip to content

Commit

Permalink
Get rid of now-unneeded waits in integration tests
Browse files Browse the repository at this point in the history
Now that we can force the NFS dir cache to invalidate at will, we should
no longer need to call WaitForLexboxMetadataUpdateAsync.
  • Loading branch information
rmunn committed May 8, 2024
1 parent cfc5a43 commit 3a82bae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 1 addition & 5 deletions backend/Testing/Services/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ... on DbError {
}
}
""");
await apiTester.InvalidateDirCache(config.Code); // Ensure newly-created project is available right away
return new LexboxProject(apiTester, config.Id);
}

Expand All @@ -84,11 +85,6 @@ public static async Task WaitForHgRefreshIntervalAsync()
await Task.Delay(TestingEnvironmentVariables.HgRefreshInterval);
}

public static async Task WaitForLexboxMetadataUpdateAsync()
{
await Task.Delay(3000);
}

private static string GetNewProjectDir(string projectCode,
[CallerMemberName] string projectName = "")
{
Expand Down
8 changes: 2 additions & 6 deletions backend/Testing/SyncReverseProxy/SendReceiveServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ public async Task ModifyProjectData(HgProtocol protocol)
var projectConfig = _srFixture.InitLocalFlexProjectWithRepo();
await using var project = await RegisterProjectInLexBox(projectConfig, _adminApiTester);

await WaitForHgRefreshIntervalAsync();

// Push the project to the server
var sendReceiveParams = new SendReceiveParams(protocol, projectConfig);
_sendReceiveService.SendReceiveProject(sendReceiveParams, AdminAuth);

await WaitForLexboxMetadataUpdateAsync();
await _adminApiTester.InvalidateDirCache(projectConfig.Code);

// Verify pushed and store last commit
var lastCommitDate = await _adminApiTester.GetProjectLastCommit(projectConfig.Code);
Expand All @@ -101,7 +99,7 @@ public async Task ModifyProjectData(HgProtocol protocol)
// Push changes
_sendReceiveService.SendReceiveProject(sendReceiveParams, AdminAuth, "Modify project data automated test");

await WaitForLexboxMetadataUpdateAsync();
await _adminApiTester.InvalidateDirCache(projectConfig.Code);

// Verify the push updated the last commit date
var lastCommitDateAfter = await _adminApiTester.GetProjectLastCommit(projectConfig.Code);
Expand All @@ -117,8 +115,6 @@ public async Task SendReceiveAfterProjectReset(HgProtocol protocol)
var projectConfig = _srFixture.InitLocalFlexProjectWithRepo(protocol, "SR_AfterReset");
await using var project = await RegisterProjectInLexBox(projectConfig, _adminApiTester);

await _adminApiTester.InvalidateDirCache(projectConfig.Code);

var sendReceiveParams = new SendReceiveParams(protocol, projectConfig);
var srResult = _sendReceiveService.SendReceiveProject(sendReceiveParams, AdminAuth);

Expand Down

0 comments on commit 3a82bae

Please sign in to comment.