コード例 #1
0
 public void VerifyImagesWithWebApps(ImageDescriptor imageDescriptor)
 {
     VerifyImages(imageDescriptor, "webapp", "powershell -command \"dir ./bin/SimpleWebApplication.dll\"", false);
 }
コード例 #2
0
 public void VerifyShell(ImageDescriptor imageDescriptor)
 {
     VerifyCommonShell(imageDescriptor, ShellValue_PowerShell);
 }
コード例 #3
0
 public void VerifyImagesWithApps(ImageDescriptor imageDescriptor)
 {
     VerifyImages(imageDescriptor, "dotnetapp", "", true);
 }
コード例 #4
0
 public void VerifyEnvironmentVariables(ImageDescriptor imageDescriptor)
 {
     VerifyCommonEnvironmentVariables(AspnetImageTests.GetEnvironmentVariables(imageDescriptor), imageDescriptor);
 }
コード例 #5
0
 public void VerifyNgenQueuesAreEmpty(ImageDescriptor imageDescriptor)
 {
     VerifyCommmonNgenQueuesAreEmpty(imageDescriptor);
 }
コード例 #6
0
        protected void VerifyCommonEnvironmentVariables(IEnumerable <EnvironmentVariableInfo> variables, ImageDescriptor imageDescriptor)
        {
            const char           delimiter = '|';
            IEnumerable <string> echoParts;
            string invokeCommand;
            char   delimiterEscape;

            if (DockerHelper.IsLinuxContainerModeEnabled)
            {
                echoParts       = variables.Select(envVar => $"${envVar.Name}");
                invokeCommand   = $"/bin/sh -c";
                delimiterEscape = '\\';
            }
            else
            {
                echoParts       = variables.Select(envVar => $"%{envVar.Name}%");
                invokeCommand   = $"CMD /S /C";
                delimiterEscape = '^';
            }

            string appId = $"envvar-{DateTime.Now.ToFileTime()}";

            string combinedValues = ImageTestHelper.DockerHelper.Run(
                image: ImageTestHelper.GetImage(ImageType, imageDescriptor.Version, imageDescriptor.OsVariant),
                name: appId,
                command: $"{invokeCommand} \"echo {String.Join($"{delimiterEscape}{delimiter}", echoParts)}\"");

            string[] values = combinedValues.Split(delimiter);
            Assert.Equal(variables.Count(), values.Count());

            for (int i = 0; i < values.Count(); i++)
            {
                EnvironmentVariableInfo variable = variables.ElementAt(i);

                string actualValue;
                // Process unset variables in Windows
                if (!DockerHelper.IsLinuxContainerModeEnabled &&
                    string.Equals(values[i], $"%{variable.Name}%", StringComparison.Ordinal))
                {
                    actualValue = string.Empty;
                }
                else
                {
                    actualValue = values[i];
                }

                if (variable.AllowAnyValue)
                {
                    Assert.NotEmpty(actualValue);
                }
                else
                {
                    Assert.Equal(variable.ExpectedValue, actualValue);
                }
            }
        }
コード例 #7
0
 public void VerifyShell(ImageDescriptor imageDescriptor)
 {
     VerifyCommonShell(imageDescriptor, ShellValue_Default);
 }
コード例 #8
0
 protected void VerifyCommmonNgenQueuesAreEmpty(ImageDescriptor imageDescriptor)
 {
     VerifyNgenQueueIsUpToDate(imageDescriptor, ImageType, @"\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen display");
     VerifyNgenQueueIsUpToDate(imageDescriptor, ImageType, @"\Windows\Microsoft.NET\Framework\v4.0.30319\ngen display");
 }
コード例 #9
0
 public void VerifyWcfImagesWithApps(ImageDescriptor imageDescriptor)
 {
     VerifyWcfImages(imageDescriptor);
 }
コード例 #10
0
 public void VerifyAspnetImagesWithApps(ImageDescriptor imageDescriptor)
 {
     VerifyAspnetImages(imageDescriptor);
 }
コード例 #11
0
        public static IEnumerable <EnvironmentVariableInfo> GetRuntimeEnvironmentVariableInfos(ImageDescriptor imageDescriptor)
        {
            yield return(new EnvironmentVariableInfo("COMPLUS_NGenProtectedProcess_FeatureEnabled", "0"));

            if ((imageDescriptor.Version == "3.5" || imageDescriptor.Version == "4.8") &&
                imageDescriptor.OsVariant != OsVersion.WSC_LTSC2016 &&
                imageDescriptor.OsVariant != OsVersion.WSC_LTSC2019 &&
                imageDescriptor.OsVariant != OsVersion.WSC_1903)
            {
                yield return(new EnvironmentVariableInfo("DOTNET_RUNNING_IN_CONTAINER", "true"));
            }
        }
コード例 #12
0
 public void VerifyEnvironmentVariables(ImageDescriptor imageDescriptor)
 {
     VerifyCommonEnvironmentVariables(GetRuntimeEnvironmentVariableInfos(imageDescriptor), imageDescriptor);
 }