public void ContainerLimits(RuntimeImageDescriptor imageDescriptor) { // Container limits are only supported on 4.8 for Server 2019 and 2022. if (imageDescriptor.Version != "4.8" || (imageDescriptor.OsVariant != OsVersion.WSC_LTSC2019 && imageDescriptor.OsVariant != OsVersion.WSC_LTSC2022)) { _imageTestHelper.OutputHelper.WriteLine("Test skipped due to unsupported version."); return; } string appId = $"container-limits-{DateTime.Now.ToFileTime()}"; string workDir = Path.Combine( Directory.GetCurrentDirectory(), "projects", $"dotnetapp-{imageDescriptor.Version}"); string baseBuildImage = _imageTestHelper.GetImage("sdk", imageDescriptor.SdkVersion, imageDescriptor.OsVariant); string baseRuntimeImage = _imageTestHelper.GetImage("runtime", imageDescriptor.Version, imageDescriptor.OsVariant); List <string> appBuildArgs = new () { $"BASE_BUILD_IMAGE={baseBuildImage}", $"BASE_RUNTIME_IMAGE={baseRuntimeImage}" }; string runCommand = "getProcessorCount"; try { _imageTestHelper.DockerHelper.Build( tag: appId, dockerfile: Path.Combine(workDir, "Dockerfile"), contextDir: workDir, buildArgs: appBuildArgs.ToArray()); string output = _imageTestHelper.DockerHelper.Run(image: appId, name: appId, command: runCommand, optionalRunArgs: "--cpus 0.5"); Assert.Equal("1", output); string processorCount = "20"; output = _imageTestHelper.DockerHelper.Run(image: appId, name: appId, command: runCommand, optionalRunArgs: $"--cpus 0.5 -e COMPLUS_PROCESSOR_COUNT={processorCount}"); Assert.Equal(processorCount, output); } finally { _imageTestHelper.DockerHelper.DeleteContainer(appId); _imageTestHelper.DockerHelper.DeleteImage(appId); } }
private void VerifyFxImages(RuntimeImageDescriptor imageDescriptor, string appDescriptor, string runCommand, bool includeRuntime) { string baseBuildImage = _imageTestHelper.GetImage("sdk", imageDescriptor.SdkVersion, imageDescriptor.OsVariant); List <string> appBuildArgs = new List <string> { $"BASE_BUILD_IMAGE={baseBuildImage}" }; if (includeRuntime) { string baseRuntimeImage = _imageTestHelper.GetImage("runtime", imageDescriptor.Version, imageDescriptor.OsVariant); appBuildArgs.Add($"BASE_RUNTIME_IMAGE={baseRuntimeImage}"); } _imageTestHelper.BuildAndTestImage( imageDescriptor: imageDescriptor, buildArgs: appBuildArgs, appDescriptor: appDescriptor, runCommand: runCommand, testUrl: "" ); }
public void VerifyImagesWithWebApps(RuntimeImageDescriptor imageDescriptor) { VerifyFxImages(imageDescriptor, "webapp", "powershell -command \"dir ./bin/SimpleWebApplication.dll\"", false); }
public void VerifyImagesWithApps(RuntimeImageDescriptor imageDescriptor) { VerifyFxImages(imageDescriptor, "dotnetapp", "", true); }