public async Task BuildOutputForUnknownBuildsShouldThrow() { var cache = new TestBlobCache(); var client = new GitHubClient(new ProductHeaderValue("Peasant")); var fixture = new BuildQueue(client, cache, (q, o) => { return Task.FromResult(0); }); bool shouldDie = true; try { await fixture.GetBuildOutput(42); } catch (Exception) { shouldDie = false; } Assert.False(shouldDie); }
public async Task BuildsThatFailShouldBeRecorded() { var cache = new TestBlobCache(); var client = new GitHubClient(new ProductHeaderValue("Peasant")); var fixture = new BuildQueue(client, cache, async (q, o) => { throw new Exception("Didn't work lol"); }); fixture.Start(); var queueItem = await fixture.Enqueue(TestBuild.RepoUrl, TestBuild.PassingBuildSHA1, TestBuild.BuildScriptUrl); Assert.NotNull(queueItem); Assert.False(queueItem.BuildSucceded.Value); fixture = new BuildQueue(client, cache); var result = await fixture.GetBuildOutput(queueItem.BuildId); Assert.True(result.Item1.Contains("Didn't work lol")); Assert.NotEqual(0, result.Item2); }
public async Task BuildsThatSucceedShouldBeRecorded() { var cache = new TestBlobCache(); var client = new GitHubClient(new ProductHeaderValue("Peasant")); var fixture = new BuildQueue(client, cache, (q, o) => { return Task.FromResult(0); }); fixture.Start(); var queueItem = await fixture.Enqueue(TestBuild.RepoUrl, TestBuild.PassingBuildSHA1, TestBuild.BuildScriptUrl); Assert.NotNull(queueItem); Assert.True(queueItem.BuildSucceded.Value); fixture = new BuildQueue(client, cache); var result = await fixture.GetBuildOutput(queueItem.BuildId); Assert.Equal(0, result.Item2); }