Skip to content

Commit 2333769

Browse files
committed
Fix vpk-deployment split fallout: dotnet-coverage, GitHub list staleness
- Restore the dotnet-coverage install in the vpk job: RunCoveredDotnet shells out to that CLI, so moving it to vpk-deployment broke MsiTests on Windows. - WaitForReleaseCountAsync now also waits until every listed release shows at least one asset (a fresh GitHub listing can briefly return a published release with an empty asset list) and allows 120s: the split job makes all three legs hit GitHub simultaneously, which worsened list-after-write lag (empty draft listings, 'No assets found' on download round-trip). - Retry GithubSourceLive rows up to 3 times: a row's fresh API calls can hit a stale replica even after the shared context confirmed the feed ('asset not found in any release' / 404 from correct clients).
1 parent b0d21e0 commit 2333769

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎.github/workflows/build-tests.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ jobs:
148148
- name: Install squashfs-tools
149149
run: brew install squashfs
150150
if: ${{ matrix.os == 'macos' }}
151+
# WindowsTestHelper.RunCoveredDotnet shells out to the dotnet-coverage CLI
152+
- name: Install dotnet-coverage
153+
run: dotnet tool install -g dotnet-coverage
151154
- name: Azure login
152155
uses: azure/login@v3
153156
if: github.event.pull_request.head.repo.full_name == github.repository

‎test/Velopack.Deployment.Tests/Infra/GitReleaseDeploymentSuite.cs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,17 @@ protected ICacheLogger<GitReleaseDeploymentSuite> CreateLogger()
248248
=> UseUniqueTags ? $"1.0.0-{channel}-{Guid.NewGuid().ToString("N")[..6]}" : null;
249249

250250
/// <summary>
251-
/// Polls the release listing until it reaches <paramref name="count"/> releases, tolerating the
252-
/// provider's list-after-write lag (GitHub's Releases API is eventually consistent). On timeout the
253-
/// latest listing is returned so the caller's assertion fails with the real state.
251+
/// Polls the release listing until it reaches <paramref name="count"/> releases and every release
252+
/// shows at least one asset, tolerating the provider's list-after-write lag (GitHub's Releases API
253+
/// is eventually consistent, and a fresh listing can briefly show a release with an empty asset
254+
/// list — every upload in this suite attaches assets, so an empty list is always staleness). On
255+
/// timeout the latest listing is returned so the caller's assertion fails with the real state.
254256
/// </summary>
255257
private static async Task<IReadOnlyList<RemoteRelease>> WaitForReleaseCountAsync(IGitReleaseScope scope, int count)
256258
{
257-
var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(60);
259+
var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(120);
258260
var releases = await scope.ListReleasesAsync();
259-
while (releases.Count != count && DateTime.UtcNow < deadline) {
261+
while ((releases.Count != count || releases.Any(r => r.AssetNames.Length == 0)) && DateTime.UtcNow < deadline) {
260262
await Task.Delay(2000);
261263
releases = await scope.ListReleasesAsync();
262264
}

‎test/Velopack.Deployment.Tests/SourceTests.cs‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,19 @@ public async Task GithubSourceLive(HarnessLang lang)
345345
var fixture = InstalledAppFixture.GetOrCreate(logger);
346346

347347
var lease = await _context.GetOrCreateAsync(fixture, logger);
348-
await SourceTestHelpers.RunRowAsync(lang, "github", lease.RepoUrl, lease.Token, prerelease: false, fixture, logger);
348+
349+
// Live GitHub's list APIs are eventually consistent per-request: even after the shared context
350+
// has confirmed the feed is visible, a row's own fresh API calls can hit a stale replica
351+
// (observed as 404s and "asset not found in any release" from otherwise-correct clients).
352+
for (var attempt = 1; ; attempt++) {
353+
try {
354+
await SourceTestHelpers.RunRowAsync(lang, "github", lease.RepoUrl, lease.Token, prerelease: false, fixture, logger);
355+
break;
356+
} catch (Exception ex) when (attempt < 3) {
357+
logger.LogWarning(ex, "GitHub source row attempt {Attempt} failed (likely list-after-write lag), retrying in 15s", attempt);
358+
await Task.Delay(TimeSpan.FromSeconds(15));
359+
}
360+
}
349361
}
350362
}
351363

0 commit comments

Comments
 (0)