async Task TestInstallStable(CancellationToken cancellationToken) { var newModel = new ByondVersionRequest { Version = TestVersion }; var test = await byondClient.SetActiveVersion(newModel, null, cancellationToken).ConfigureAwait(false); Assert.IsNotNull(test.InstallJob); await WaitForJob(test.InstallJob, 120, false, null, cancellationToken).ConfigureAwait(false); var currentShit = await byondClient.ActiveVersion(cancellationToken).ConfigureAwait(false); Assert.AreEqual(newModel.Version.Semver(), currentShit.Version); var dreamMaker = "DreamMaker"; if (new PlatformIdentifier().IsWindows) { dreamMaker += ".exe"; } var dreamMakerDir = Path.Combine(metadata.Path, "Byond", newModel.Version.ToString(), "byond", "bin"); Assert.IsTrue(Directory.Exists(dreamMakerDir), $"Directory {dreamMakerDir} does not exist!"); Assert.IsTrue(File.Exists(Path.Combine(dreamMakerDir, dreamMaker)), $"Missing DreamMaker executable! Dir contents: {String.Join(", ", Directory.GetFileSystemEntries(dreamMakerDir))}"); }
async Task TestInstall511(CancellationToken cancellationToken) { var newModel = new Api.Models.Byond { Version = new Version(511, 1385) }; var test = await byondClient.SetActiveVersion(newModel, cancellationToken).ConfigureAwait(false); Assert.IsNotNull(test.InstallJob); Assert.IsNull(test.Version); var job = test.InstallJob; var maxWait = 60; //it's 10MB max give me a break do { await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false); job = await jobsClient.GetId(job, cancellationToken).ConfigureAwait(false); --maxWait; }while (!job.StoppedAt.HasValue && maxWait > 0); if (!job.StoppedAt.HasValue) { await jobsClient.Cancel(job, cancellationToken).ConfigureAwait(false); Assert.Fail("Byond installation job timed out!"); } if (job.ExceptionDetails != null) { Assert.Fail(job.ExceptionDetails); } var currentShit = await byondClient.ActiveVersion(cancellationToken).ConfigureAwait(false); Assert.AreEqual(newModel.Version, currentShit.Version); }