Skip to content

Commit

Permalink
Add retries for checking GitHub release
Browse files Browse the repository at this point in the history
  • Loading branch information
MattEqualsCoder committed Jul 14, 2024
1 parent d05bdd9 commit 87d4681
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/TrackerCouncil.Smz3.Tests/MetaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,20 @@ public async Task ValidateVersionNumber()
.BuildServiceProvider();

// Get latest version from GitHub and make sure the current version is newer
var releases = await serviceProvider.GetRequiredService<IGitHubReleaseService>()
.GetReleasesAsync("TheTrackerCouncil", "SMZ3Randomizer");
var latestRelease = releases?.FirstOrDefault();
GitHubRelease? latestRelease = null;

for (var i = 0; i < 5 && latestRelease == null; i++)
{
var releases = await serviceProvider.GetRequiredService<IGitHubReleaseService>()
.GetReleasesAsync("TheTrackerCouncil", "SMZ3Randomizer");
latestRelease = releases?.FirstOrDefault();

if (latestRelease == null)
{
await Task.Delay(TimeSpan.FromSeconds(5));
}
}

latestRelease.Should().NotBeNull();
latestRelease!.Tag.Should().NotBeEquivalentTo($"v{version}");
serviceProvider.GetRequiredService<IGitHubReleaseCheckerService>()
Expand Down

0 comments on commit 87d4681

Please sign in to comment.