public void CreatesAssumeRoleRequestWithExpectedParams(string arn, string sessionName, string duration, int?expectedDuration) { IVariables variables = new CalamariVariables(); variables.Add("Octopus.Action.Aws.AssumeRole", "True"); variables.Add("Octopus.Action.Aws.AssumedRoleArn", arn); variables.Add("Octopus.Action.Aws.AssumedRoleSession", sessionName); variables.Add("Octopus.Action.Aws.AssumeRoleSessionDurationSeconds", duration); var awsEnvironmentGenerator = new AwsEnvironmentGeneration(Substitute.For <ILog>(), variables); var request = awsEnvironmentGenerator.GetAssumeRoleRequest(); request.RoleArn.Should().Be(arn); request.RoleSessionName.Should().Be(sessionName); request.DurationSeconds.Should().Be(expectedDuration); }
public void ShouldBeEnabled(string connectionEndpoint, ScriptSyntax syntax, bool expected) { var variables = new CalamariVariables(); variables.Add(SpecialVariables.Action.ServiceFabric.ConnectionEndpoint, connectionEndpoint); var target = new AzureServiceFabricPowerShellContext(variables); var actual = target.IsEnabled(syntax); actual.Should().Be(expected); }
public async Task TestSiteAppSettings() { await webMgmtClient.WebApps.UpdateApplicationSettingsWithHttpMessagesAsync(resourceGroupName, site.Name, existingSettings); await webMgmtClient.WebApps.UpdateConnectionStringsAsync(resourceGroupName, site.Name, existingConnectionStrings); var iVars = new CalamariVariables(); AddVariables(iVars); var runningContext = new RunningDeployment("", iVars); iVars.Add("Greeting", "Calamari"); var appSettings = BuildAppSettingsJson(new[]
public async Task AzureLinuxContainerSlotDeploy() { var slotName = "stage"; newVariables = new CalamariVariables(); AddVariables(newVariables); newVariables.Add("Octopus.Action.Azure.DeploymentSlot", slotName); var slot = await webMgmtClient.WebApps.BeginCreateOrUpdateSlotAsync(resourceGroupName, webappName, site, slotName); var runningContext = new RunningDeployment("", newVariables); await new AzureAppServiceDeployContainerBehavior(new InMemoryLog()).Execute(runningContext); await AssertDeploySuccessAsync(AzureWebAppHelper.GetAzureTargetSite(site.Name, slotName, resourceGroupName)); }
void AddVariables(CalamariVariables vars) { vars.Add(AccountVariables.ClientId, clientId); vars.Add(AccountVariables.Password, clientSecret); vars.Add(AccountVariables.TenantId, tenantId); vars.Add(AccountVariables.SubscriptionId, subscriptionId); vars.Add("Octopus.Action.Azure.ResourceGroupName", resourceGroupName); vars.Add("Octopus.Action.Azure.WebAppName", webappName); vars.Add(SpecialVariables.Action.Package.FeedId, "Feeds-42"); vars.Add(SpecialVariables.Action.Package.Registry, "index.docker.io"); vars.Add(SpecialVariables.Action.Package.PackageId, "nginx"); vars.Add(SpecialVariables.Action.Package.Image, "nginx:latest"); vars.Add(SpecialVariables.Action.Package.PackageVersion, "latest"); vars.Add(SpecialVariables.Action.Azure.DeploymentType, "Container"); //vars.Add(SpecialVariables.Action.Azure.ContainerSettings, BuildContainerConfigJson()); }