private void LogSuccessfulDeployment(DeploymentResponse response) { output.Success($"Your deployment has begun! \\(^?^)/"); output.Info(); output.Success($"You can monitor the status of your deployment at {response.ManagementUrl}"); output.Info(); if (!string.IsNullOrWhiteSpace(response.IngressUrl)) { output.Success($"Your application will be available at {response.IngressUrl}"); output.Info(); } foreach (var service in response.Services) { var publicAccess = service.IngressUrl != null ? $"publicly at {service.IngressUrl}, and " : null; var ports = service.Ports.Any() ? ". " + string.Join(" ", service.Ports.Select(port => port.ExposedPort != null ? $"Port {port.TargetPort} can be accessed publicly at {port.HostName}:{port.ExposedPort}." : $"Port {port.TargetPort} will be randomly assigned a port for public access. This will be shown on the management web UI once assigned.")) : ""; output.Success( $"The service {service.Name} is accessible {publicAccess}from other clud services at the hostname {service.InternalHostname}{ports}"); } output.Info(); }
public void TestLogUrlId(string url, string id, string expectedUrl) { DeploymentResponse deploymentResponse = null; if (!string.IsNullOrEmpty(url) || !string.IsNullOrEmpty(id) || !string.IsNullOrEmpty(expectedUrl)) { deploymentResponse = new() { Id = id, Status = DeployStatus.Success, LogUrl = url, }; } Assert.Equal(expectedUrl, deploymentResponse?.GetLogUrlWithId()); }
public static void ConfigureMappers() { AutoMapping.RegisterConverter <Neo4jVersion, Version>(nv => { var version = nv.ConvertTo <Version>(skipConverters: true); version.VersionNumber = nv.Version; return(version); }); AutoMapping.RegisterConverter <Neo4jEndpoints, Endpoints>(neo4jEndpoints => { var endpoints = new Endpoints { BoltEndpoint = neo4jEndpoints.BoltEndpoint?.AbsoluteUri, HttpEndpoint = neo4jEndpoints.HttpEndpoint?.AbsoluteUri, HttpsEndpoint = neo4jEndpoints.HttpsEndpoint?.AbsoluteUri }; return(endpoints); }); AutoMapping.RegisterConverter <KeyValuePair <string, INeo4jInstance>, Deployment>(kvp => { var neo4JDeployment = kvp.Value.Deployment; var deployment = neo4JDeployment.ConvertTo <Deployment>(); deployment.Id = kvp.Key; deployment.Status = kvp.Value.Status.ToString(); deployment.BackupName = Path.GetFileName(neo4JDeployment.LastBackupFile); return(deployment); }); AutoMapping.RegisterConverter <KeyValuePair <string, INeo4jInstance>, DeploymentResponse>(kvp => { var response = new DeploymentResponse { Deployment = kvp.ConvertTo <Deployment>() }; return(response); }); }
public async Task PollDeploymentStatusTest_ForValidResponses(HttpStatusCode responseStatusCode, DeployStatus expectedDeployStatus) { // Arrange string deployUrl = "https://sitename.scm.azurewebsites.net/DeploymentStatus?Id=knownId"; Action <Mock <IHttpClient>, bool> verifyStep = (client, result) => { client.Verify(c => c.GetAsync( It.Is <Uri>(uri => string.Equals(uri.AbsoluteUri, deployUrl, StringComparison.Ordinal)), It.IsAny <CancellationToken>())); Assert.Equal($"{UserAgentName}/{UserAgentVersion}", client.Object.DefaultRequestHeaders.GetValues("User-Agent").FirstOrDefault()); Assert.True(result); }; var deploymentResponse = new DeploymentResponse() { Id = "20a106ca-3797-4dbb", Status = expectedDeployStatus, LogUrl = "https://mywebapp.scm.azurewebsites.net/api/deployments/latest/log", }; Mock <IHttpClient> client = new Mock <IHttpClient>(); HttpRequestMessage requestMessage = new HttpRequestMessage(); client.Setup(x => x.DefaultRequestHeaders).Returns(requestMessage.Headers); client.Setup(c => c.GetAsync(new Uri(deployUrl, UriKind.RelativeOrAbsolute), It.IsAny <CancellationToken>())).Returns(() => { string statusJson = JsonSerializer.Serialize(deploymentResponse); HttpContent httpContent = new StringContent(statusJson, Encoding.UTF8, "application/json"); HttpResponseMessage responseMessage = new HttpResponseMessage(responseStatusCode) { Content = httpContent }; return(Task.FromResult(responseMessage)); }); ZipDeploymentStatus deploymentStatus = new ZipDeploymentStatus(client.Object, $"{UserAgentName}/{UserAgentVersion}", null, false); // Act var actualdeployStatus = await deploymentStatus.PollDeploymentStatusAsync(deployUrl, userName, password); // Assert verifyStep(client, expectedDeployStatus == actualdeployStatus.Status); }
private static void AssertDeploymentSectionEqual(DeploymentResponse expected, DeploymentResponse actual) { actual.NuGetPackages.Should().BeEquivalentTo(expected.NuGetPackages, "NuGet package information differs"); }
private static void AssertDeploymentSectionEqual(DeploymentResponse expected, DeploymentResponse actual) { CollectionAssert.AreEqual(expected.NuGetPackages, actual.NuGetPackages, "NuGet package information differs"); }