Example #1
0
        private async Task VerifyRuntimeImage_FrameworkDependentApp(ImageData imageData, string appSdkImage)
        {
            string frameworkDepAppId             = GetIdentifier(imageData.DotNetVersion, "framework-dependent-app");
            bool   isRunAsContainerAdministrator =
                String.Equals(OS.NanoServer1709, imageData.OsVariant, StringComparison.OrdinalIgnoreCase) ||
                String.Equals(OS.NanoServer1803, imageData.OsVariant, StringComparison.OrdinalIgnoreCase) ||
                String.Equals(OS.NanoServer1809, imageData.OsVariant, StringComparison.OrdinalIgnoreCase);
            string publishCmd = GetPublishArgs(imageData);

            try
            {
                // Publish the app to a Docker volume using the app's sdk image
                _dockerHelper.Run(
                    image: appSdkImage,
                    command: publishCmd,
                    containerName: frameworkDepAppId,
                    volumeName: frameworkDepAppId,
                    runAsContainerAdministrator: isRunAsContainerAdministrator);

                // Run the app in the Docker volume to verify the runtime image
                string runtimeImage = GetDotNetImage(
                    imageData.IsWeb ? DotNetImageType.AspNetCore_Runtime : DotNetImageType.Runtime, imageData);
                string appDllPath = _dockerHelper.GetContainerWorkPath("testApp.dll");
                _dockerHelper.Run(
                    image: runtimeImage,
                    command: $"dotnet {appDllPath}",
                    containerName: frameworkDepAppId,
                    volumeName: frameworkDepAppId,
                    detach: imageData.IsWeb,
                    runAsContainerAdministrator: isRunAsContainerAdministrator);

                if (imageData.IsWeb && !s_isHttpVerificationDisabled)
                {
                    await VerifyHttpResponseFromContainer(frameworkDepAppId);
                }
            }
            finally
            {
                _dockerHelper.DeleteContainer(frameworkDepAppId);
                _dockerHelper.DeleteVolume(frameworkDepAppId);
            }
        }
Example #2
0
        private async Task VerifyRuntimeImage_FrameworkDependentApp(ImageData imageData, string appSdkImage)
        {
            string frameworkDepAppId             = GetIdentifier(imageData.DotNetVersion, "framework-dependent-app");
            bool   isRunAsContainerAdministrator = String.Equals(
                "nanoserver-1709", imageData.PlatformOS, StringComparison.OrdinalIgnoreCase);
            string optionalPublishArgs = GetOptionalPublishArgs(imageData);

            try
            {
                // Publish the app to a Docker volume using the app's sdk image
                _dockerHelper.Run(
                    image: appSdkImage,
                    command: $"dotnet publish -o {DockerHelper.ContainerWorkDir} {optionalPublishArgs}",
                    containerName: frameworkDepAppId,
                    volumeName: frameworkDepAppId,
                    runAsContainerAdministrator: isRunAsContainerAdministrator);

                // Run the app in the Docker volume to verify the runtime image
                string runtimeImage = GetDotNetImage(
                    imageData.IsWeb ? DotNetImageType.AspNetCore_Runtime : DotNetImageType.Runtime, imageData);
                string appDllPath = _dockerHelper.GetContainerWorkPath("testApp.dll");
                _dockerHelper.Run(
                    image: runtimeImage,
                    command: $"dotnet {appDllPath}",
                    containerName: frameworkDepAppId,
                    volumeName: frameworkDepAppId,
                    detach: imageData.IsWeb,
                    runAsContainerAdministrator: isRunAsContainerAdministrator);

                if (imageData.IsWeb)
                {
                    await VerifyHttpResponseFromContainer(frameworkDepAppId);
                }
            }
            finally
            {
                _dockerHelper.DeleteContainer(frameworkDepAppId);
                _dockerHelper.DeleteVolume(frameworkDepAppId);
            }
        }