Exemplo n.º 1
0
 protected virtual void AssertUnauthenticatedProxyUsed(CalamariResult output)
 {
     output.AssertSuccess();
     output.AssertPropertyValue("HTTP_PROXY", proxyUrl);
     output.AssertPropertyValue("HTTPS_PROXY", proxyUrl);
     output.AssertPropertyValue("NO_PROXY", "127.0.0.1,localhost,169.254.169.254");
 }
Exemplo n.º 2
0
 void AssertPSEdition(CalamariResult output)
 {
     // Checking for not containing 'Core' as Build Servers run on
     // PowerShell 3 which does not have PSEdition in the output
     output.CapturedOutput.AllMessages.Select(i => i.TrimEnd()).Should()
     .NotContain($"PSEdition                      Core");
 }
        public void Deploy()
        {
            OctopusTestAzureSubscription.IgnoreIfCertificateNotInstalled();

            var nugetPackageFile = PackageBuilder.BuildSamplePackage("Octopus.Sample.AzureCloudService", "1.0.0");

            var variablesFile = Path.GetTempFileName();
            var variables     = new VariableDictionary();

            OctopusTestAzureSubscription.PopulateVariables(variables);
            OctopusTestCloudService.PopulateVariables(variables);
            variables.Set(SpecialVariables.Action.Azure.Slot, "Staging");
            variables.Set(SpecialVariables.Action.Azure.SwapIfPossible, false.ToString());
            variables.Set(SpecialVariables.Action.Azure.UseCurrentInstanceCount, false.ToString());

            variables.Set(SpecialVariables.Action.Name, "AzureCloudService");
            variables.Set(SpecialVariables.Release.Number, "1.0.0");

            // Disable cspkg extraction
            variables.Set(SpecialVariables.Action.Azure.CloudServicePackageExtractionDisabled, true.ToString());

            fileSystem       = new WindowsPhysicalFileSystem();
            stagingDirectory = Path.GetTempPath();
            variables.Set(SpecialVariables.Action.Azure.PackageExtractionPath, stagingDirectory);

            variables.Save(variablesFile);

            result = Invoke(
                Calamari()
                .Action("deploy-azure-cloud-service")
                .Argument("package", nugetPackageFile)
                .Argument("variables", variablesFile));
        }
Exemplo n.º 4
0
 protected virtual void AssertProxyBypassed(CalamariResult output)
 {
     output.AssertSuccess();
     output.AssertPropertyValue("HTTP_PROXY", "");
     output.AssertPropertyValue("HTTPS_PROXY", "");
     output.AssertPropertyValue("NO_PROXY", "*");
 }
Exemplo n.º 5
0
 void AssertUnauthenticatedSystemProxyUsedWithException(CalamariResult output, string bypassedUrl)
 {
     AssertUnauthenticatedSystemProxyUsed(output);
     if (TestWebRequestDefaultProxy)
     {
         output.AssertPropertyValue("ProxyBypassed", bypassedUrl);
     }
 }
Exemplo n.º 6
0
 protected override void AssertProxyBypassed(CalamariResult output)
 {
     base.AssertProxyBypassed(output);
     if (IsRunningOnWindows && TestWebRequestDefaultProxy)
     {
         output.AssertPropertyValue("WebRequest.DefaultProxy", "None");
     }
 }
        void AssertAuthenticatedSystemProxyUsed(CalamariResult output)
        {
#if !NETCORE
            AssertAuthenticatedProxyUsed(output);
#else
            base.AssertNoProxyChanges(output);
#endif
        }
Exemplo n.º 8
0
 protected override void AssertUnauthenticatedProxyUsed(CalamariResult output)
 {
     base.AssertUnauthenticatedProxyUsed(output);
     if (IsRunningOnWindows && TestWebRequestDefaultProxy)
     {
         output.AssertPropertyValue("WebRequest.DefaultProxy", proxyUrl + "/");
     }
 }
Exemplo n.º 9
0
        public void ShouldRemoveArtifactsWhenReleasesSpecified()
        {
            result = Clean("retentionPolicySet1", null, 1);

            result.AssertSuccess();

            Assert.False(fileSystem.DirectoryExists(Path.Combine(stagingDirectory, "Acme.1.0.0")));
            Assert.False(fileSystem.FileExists(Path.Combine(packagesDirectory, "Acme.1.0.0.nupkg")));
        }
Exemplo n.º 10
0
 protected override void AssertAuthenticatedProxyUsed(CalamariResult output)
 {
     base.AssertAuthenticatedProxyUsed(output);
     if (IsRunningOnWindows && TestWebRequestDefaultProxy)
     {
         // This can be either the authenticated or unauthenticated URL. The authentication part should be ignored
         output.AssertPropertyValue("WebRequest.DefaultProxy", proxyUrl + "/", authenticatedProxyUrl + "/");
     }
 }
        void AssertUnauthenticatedSystemProxyUsedWithException(CalamariResult output, string bypassedUrl)
        {
#if !NETCORE
            AssertUnauthenticatedSystemProxyUsed(output);
            if (TestWebRequestDefaultProxy)
            {
                output.AssertPropertyValue("ProxyBypassed", bypassedUrl);
            }
#else
            base.AssertNoProxyChanges(output);
#endif
        }
Exemplo n.º 12
0
        void AssertPowerShellEdition(CalamariResult output)
        {
            const string powerShellCoreEdition = "PSEdition                      Core";
            var          trimmedOutput         = output.CapturedOutput.AllMessages.Select(i => i.TrimEnd());

            if (PowerShellEdition == PowerShellEdition.Core)
            {
                trimmedOutput.Should().Contain(powerShellCoreEdition);
            }
            else
            {
                // Checking for not containing 'Core' as Build Servers run on
                // PowerShell 3 which does not have PSEdition in the output
                trimmedOutput.Should().NotContain(powerShellCoreEdition);
            }
        }
Exemplo n.º 13
0
        public void Deploy()
        {
            const string webAppName = "octodemo003-dev";

            OctopusTestAzureSubscription.IgnoreIfCertificateNotInstalled();

            variables = new VariableDictionary();
            OctopusTestAzureSubscription.PopulateVariables(variables);
            variables.Set(SpecialVariables.Action.Azure.WebAppName, webAppName);

            variables.Set("foo", "bar");
            // Enable file substitution and configure the target
            variables.Set(SpecialVariables.Package.SubstituteInFilesEnabled, true.ToString());
            variables.Set(SpecialVariables.Package.SubstituteInFilesTargets, "web.config");

            fileSystem       = new WindowsPhysicalFileSystem();
            stagingDirectory = Path.GetTempPath();
            variables.Set(SpecialVariables.Action.Azure.PackageExtractionPath, stagingDirectory);

            result = DeployPackage("Acme.Web");
        }
 static void AssertPackageHashMatchesExpected(CalamariResult result, string expectedHash)
 {
     result.AssertOutputVariable("StagedPackage.Hash", Is.EqualTo(expectedHash));
 }
Exemplo n.º 15
0
 static void AssertStagePackageOutputVariableSet(CalamariResult result, string filePath)
 {
     result.AssertOutputVariable("StagedPackage.FullPathOnRemoteMachine", Does.StartWith(filePath));
 }
 static void AssertPackageSizeMatchesExpected(CalamariResult result, long expectedSize)
 {
     result.AssertOutputVariable("StagedPackage.Size", Is.EqualTo(expectedSize.ToString(CultureInfo.InvariantCulture)));
 }
        static void AssertStagePackageOutputVariableSet(CalamariResult result, SampleFeedPackage testFeed)
        {
            var newPacakgeRegex = PackageName.ToRegexPattern(testFeed.PackageId, testFeed.Version, testFeed.DownloadFolder);

            result.AssertOutputVariable("StagedPackage.FullPathOnRemoteMachine", Does.Match(newPacakgeRegex + ".*"));
        }
Exemplo n.º 18
0
 void AssertAuthenticatedSystemProxyUsed(CalamariResult output)
 {
     AssertAuthenticatedProxyUsed(output);
 }