From 6edb3f117d1069d7f8f5091ab3fb6b51bc57fde7 Mon Sep 17 00:00:00 2001 From: Kiran Date: Tue, 3 Nov 2020 12:10:10 -0800 Subject: [PATCH] Updated tests to use intermediate directory (#831) --- .../DotNetCoreDynamicInstallTest.cs | 10 +- .../DotNetCorePreRunCommandOrScriptTest.cs | 17 ++- .../DotNetCoreRuntimeVersion10Tests.cs | 7 +- .../DotNetCoreRuntimeVersion11Tests.cs | 14 +- .../DotNetCoreRuntimeVersion20Tests.cs | 7 +- .../DotNetCoreRuntimeVersion21Tests.cs | 86 ++++++------ .../DotNetCoreRuntimeVersion22Tests.cs | 35 ++--- .../DotNetCoreRuntimeVersion30Tests.cs | 41 +++--- .../DotNetCoreRuntimeVersion31Tests.cs | 34 +++-- .../DotNetCoreRuntimeVersion50Tests.cs | 12 +- .../Node/NodeAngularAppTest.cs | 126 +++++++++--------- .../Node/NodeDynamicInstallationTest.cs | 22 +-- .../Node/NodeEndToEndTestsBase.cs | 2 +- .../Node/NodeLegacyVersionsEndToEndTest.cs | 23 ++-- .../Node/NodeNextJsAppTest.cs | 17 ++- .../Node/NodeNuxtJsAppTest.cs | 17 ++- .../Node/NodeOtherEndtoEndTests.cs | 4 +- .../Node/NodePreRunCommandOrScriptTest.cs | 30 +++-- .../Node/NodeSassExampleTest.cs | 15 ++- .../NodeTestBuildAndRunAppWithDebugger.cs | 12 +- .../Node/NodeTestUsingZippedNodeModules.cs | 26 ++-- .../Node/NodeTestWithAppInsightsConfigured.cs | 30 +++-- .../Node/NodeWebFrontEndAppTest.cs | 36 ++--- .../Php/PhpDynamicInstallationTest.cs | 11 +- .../Php/PhpEndToEndTestsBase.cs | 3 +- .../Oryx.Integration.Tests/Php/PhpExifTest.cs | 22 +-- tests/Oryx.Integration.Tests/Php/PhpGdTest.cs | 22 +-- .../Php/PhpGreetingsAppTest.cs | 20 ++- .../Php/PhpImagickExampleTest.cs | 20 ++- .../Php/PhpPreRunCommandOrScriptTest.cs | 43 +++--- .../Php/PhpTwigExampleTest.cs | 26 ++-- .../Php/PhpWordPressTest.cs | 28 ++-- .../PlatformEndToEndTestsBase.cs | 8 ++ .../Python/Python27EndToEndTests.cs | 25 ++-- .../Python/Python37EndToEndTests.cs | 46 ++++--- .../PythonBackwardCompatibilityTests.cs | 29 ++-- .../Python/PythonCustomStartUpCommandTest.cs | 25 ++-- .../Python/PythonDebuggingTests.cs | 13 +- .../Python/PythonDjangoAppTests.cs | 34 +++-- .../Python/PythonDynamicInstallationTest.cs | 44 +++--- .../Python/PythonEndToEndTests.cs | 57 +++++--- .../Python/PythonEndToEndTestsBase.cs | 2 +- .../Python/PythonGunicornMultiWorkersTest.cs | 9 +- .../PythonPortEnvironmentVariableTests.cs | 24 ++-- .../Python/PythonPreRunCommandOrScriptTest.cs | 29 ++-- .../Python/PythonShapelyAppTests.cs | 18 ++- 46 files changed, 684 insertions(+), 497 deletions(-) diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreDynamicInstallTest.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreDynamicInstallTest.cs index 6472ba1c2..f7df61ded 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreDynamicInstallTest.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreDynamicInstallTest.cs @@ -5,9 +5,8 @@ using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.DotNetCore; -using Microsoft.Oryx.BuildScriptGeneratorCli; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.DotNetCore; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -34,11 +33,12 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} " + + $"oryx build {appDir} -i /tmp/int " + $"--platform {DotNetCoreConstants.PlatformName} --platform-version {runtimeVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -51,7 +51,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCorePreRunCommandOrScriptTest.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCorePreRunCommandOrScriptTest.cs index faef961c7..8d3ac480b 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCorePreRunCommandOrScriptTest.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCorePreRunCommandOrScriptTest.cs @@ -34,11 +34,13 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform dotnet --platform-version {runtimeVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int " + + $"--platform dotnet --platform-version {runtimeVersion} -o {appOutputDir}") .ToString(); // split run script to test pre-run command before running the app. @@ -67,7 +69,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp31MvcApp, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] @@ -99,15 +101,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var preRunScriptPath = $"{appOutputDir}/prerunscript.sh"; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform dotnet --platform-version {runtimeVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int --platform dotnet " + + $"--platform-version {runtimeVersion} -o {appOutputDir}") .ToString(); - // split run script to test pre-run command and then run the app var runtimeImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() @@ -140,7 +143,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp31MvcApp, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion10Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion10Tests.cs index 8423e686d..e08bedbbf 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion10Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion10Tests.cs @@ -30,14 +30,15 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", "aspnetcore10"); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( SettingsKeys.DynamicInstallRootDir, BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot) .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotNetCoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -49,7 +50,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp11WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion11Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion11Tests.cs index 654366966..b3278a05b 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion11Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion11Tests.cs @@ -30,14 +30,15 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp11WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( SettingsKeys.DynamicInstallRootDir, BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot) .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -49,7 +50,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp11WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -80,14 +81,15 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( SettingsKeys.DynamicInstallRootDir, BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot) .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -99,7 +101,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion20Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion20Tests.cs index 51e6c5793..87a64a761 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion20Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion20Tests.cs @@ -30,14 +30,15 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", "aspnetcore20"); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( SettingsKeys.DynamicInstallRootDir, BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot) .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotNetCoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -49,7 +50,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( "aspnetcore20", _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion21Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion21Tests.cs index 1af5d00d1..ed2269414 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion21Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion21Tests.cs @@ -33,10 +33,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp21WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion}") .AddFileExistsCheck($"{appOutputDir}/{FilePaths.BuildManifestFileName}") // NOTE: Delete the manifest file explicitly @@ -52,7 +53,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -82,11 +83,13 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp21WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir/appOutput"; - var manifestDir = $"{appDir}/myoutputdir/manifestDir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; + var manifestDirVolume = CreateAppOutputDirVolume(); + var manifestDir = manifestDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} " + $"--manifest-dir {manifestDir}") .AddFileExistsCheck($"{manifestDir}/{FilePaths.BuildManifestFileName}") @@ -100,7 +103,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume, manifestDirVolume }, "/bin/sh", new[] { @@ -132,10 +135,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", "NetCoreApp21WithExplicitAssemblyName"); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion}") .AddFileExistsCheck($"{appOutputDir}/{FilePaths.BuildManifestFileName}") // NOTE: Delete the manifest file explicitly @@ -151,7 +155,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -171,7 +175,6 @@ namespace Microsoft.Oryx.Integration.Tests var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/"); Assert.Contains("Hello World!", data); }); - } [Fact] @@ -182,10 +185,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp21WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -198,7 +202,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -229,10 +233,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -244,7 +249,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -292,11 +297,12 @@ namespace Microsoft.Oryx.Integration.Tests var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; var startupFilePath = "/tmp/run.sh"; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var tempAppDir = "/tmp/app"; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -311,7 +317,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -342,11 +348,12 @@ namespace Microsoft.Oryx.Integration.Tests var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; var userStartupFile = "/tmp/userStartup.sh"; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var tempAppDir = "/tmp/app"; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -365,7 +372,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp21WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -397,10 +404,11 @@ namespace Microsoft.Oryx.Integration.Tests var volume = DockerVolume.CreateMirror(hostDir); var repoDir = volume.ContainerDir; var setProjectEnvVariable = "export PROJECT=src/WebApp1/WebApp1.csproj"; - var appOutputDir = $"{repoDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand(setProjectEnvVariable) - .AddCommand($"oryx build {repoDir} -o {appOutputDir}") // Do not specify platform and version + .AddCommand($"oryx build {repoDir} -i /tmp/int -o {appOutputDir}") // Do not specify platform and version .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand(setProjectEnvVariable) @@ -412,7 +420,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -443,9 +451,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var repoDir = volume.ContainerDir; - var appOutputDir = $"{repoDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {repoDir} -o {appOutputDir}") + .AddCommand($"oryx build {repoDir} -i /tmp/int -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") @@ -455,7 +464,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -497,9 +506,9 @@ namespace Microsoft.Oryx.Integration.Tests var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .SetEnvironmentVariable("PROJECT", "src/WebApp1/WebApp1.csproj") - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .SetEnvironmentVariable("PROJECT", "src/WebApp2/WebApp2.csproj") - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .AddFileExistsCheck($"{appOutputDir}/MyWebApp.dll") .AddFileExistsCheck($"{appOutputDir}/MyWebApp.runtimeconfig.json") .AddFileExistsCheck($"{appOutputDir}/WebApp2.dll") @@ -552,9 +561,9 @@ namespace Microsoft.Oryx.Integration.Tests var defaultAppDir = defaultAppVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .SetEnvironmentVariable("PROJECT", "src/WebApp1/WebApp1.csproj") - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .SetEnvironmentVariable("PROJECT", "src/WebApp2/WebApp2.csproj") - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .AddFileExistsCheck($"{appOutputDir}/MyWebApp.dll") .AddFileExistsCheck($"{appOutputDir}/MyWebApp.runtimeconfig.json") .AddFileExistsCheck($"{appOutputDir}/WebApp2.dll") @@ -606,11 +615,11 @@ namespace Microsoft.Oryx.Integration.Tests var appOutputDir = appOutputDirVolume.ContainerDir; var renamedAppName = $"{NetCoreApp21WebApp}-renamed"; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") // Rename the project file to get different set of publish output from the earlier build .AddCommand($"mv {appDir}/{NetCoreApp21WebApp}.csproj {appDir}/{renamedAppName}.csproj") // Rebuild again - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .AddFileExistsCheck($"{appOutputDir}/{NetCoreApp21WebApp}.dll") .AddFileExistsCheck($"{appOutputDir}/{NetCoreApp21WebApp}.runtimeconfig.json") .AddFileExistsCheck($"{appOutputDir}/{renamedAppName}.dll") @@ -657,11 +666,12 @@ namespace Microsoft.Oryx.Integration.Tests var volume = DockerVolume.CreateMirror(hostDir); var repoDir = volume.ContainerDir; var setProjectEnvVariable = "export PROJECT=src/WebApp1/WebApp1.csproj"; - var appOutputDir = $"{repoDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand(setProjectEnvVariable) .SetEnvironmentVariable(SettingsKeys.DisableRecursiveLookUp, "true") - .AddCommand($"oryx build {repoDir} -o {appOutputDir}") + .AddCommand($"oryx build {repoDir} -i /tmp/int -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand(setProjectEnvVariable) @@ -673,7 +683,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion22Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion22Tests.cs index 29f97da3d..450e63ba6 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion22Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion22Tests.cs @@ -30,9 +30,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp22WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); @@ -49,7 +50,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp22WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -79,10 +80,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp22WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .SetEnvironmentVariable(EnvironmentSettingsKeys.MSBuildConfiguration, "Debug") - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -94,7 +96,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp22WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -124,10 +126,11 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp22WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -140,7 +143,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp22WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -170,9 +173,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp22WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -185,7 +189,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp22WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -216,9 +220,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .AddFileExistsCheck($"{appOutputDir}/foo bar.dll") .ToString(); @@ -231,7 +236,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion30Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion30Tests.cs index a8f881873..036333f76 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion30Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion30Tests.cs @@ -29,9 +29,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", "FSharpNetCoreApp21.WebApp"); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand( @@ -42,7 +43,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp22WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -73,9 +74,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp30WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -87,7 +89,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -117,9 +119,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp30MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -131,7 +134,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -172,7 +175,8 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp30WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .Source($"benv dotnet={DotNetCoreSdkVersions.DotNetCore30SdkVersion}") .AddCommand($"cd {appDir}") @@ -187,7 +191,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -254,10 +258,12 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp30WebApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var startupCommand = "./NetCoreApp30.WebApp"; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -o {appOutputDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -270,7 +276,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -301,9 +307,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -315,7 +322,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion31Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion31Tests.cs index d1a855e14..db7d99eec 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion31Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion31Tests.cs @@ -30,9 +30,10 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp31MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + .AddCommand($"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -44,7 +45,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -74,22 +75,24 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp31MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} " + - $"-o {appDir}/output") + $"-o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx create-script -appPath {appDir}/output -bindPort {ContainerPort}") + $"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp30WebApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -120,21 +123,23 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} --platform-version {version} " + - $"-o {appDir}/output") + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + + $"--platform-version {version} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx create-script -appPath {appDir}/output -bindPort {ContainerPort}") + $"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -169,7 +174,7 @@ namespace Microsoft.Oryx.Integration.Tests var expectedFileInOutputDir = Guid.NewGuid().ToString("N"); var buildImageScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") // Create a 'build.env' file .AddCommand( @@ -231,7 +236,8 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", NetCoreApp31MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .Source($"benv dotnet={DotNetCoreSdkVersions.DotNetCore31SdkVersion}") .AddCommand($"cd {appDir}") @@ -246,7 +252,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( NetCoreApp31MvcApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion50Tests.cs b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion50Tests.cs index cb9e8a7b7..3db7c606d 100644 --- a/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion50Tests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCore/DotNetCoreRuntimeVersion50Tests.cs @@ -30,11 +30,12 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", Net5MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform {DotNetCoreConstants.PlatformName} " + + $"oryx build {appDir} -i /tmp/int --platform {DotNetCoreConstants.PlatformName} " + $"--platform-version {dotnetcoreVersion} -o {appOutputDir}") .ToString(); var runtimeImageScript = new ShellScriptBuilder() @@ -46,7 +47,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( Net5MvcApp, _output, - new DockerVolume[] { volume }, + new DockerVolume[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] @@ -88,7 +89,8 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "DotNetCore", Net5MvcApp); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildImageScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( @@ -108,7 +110,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( Net5MvcApp, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Node/NodeAngularAppTest.cs b/tests/Oryx.Integration.Tests/Node/NodeAngularAppTest.cs index fd27298b1..c262ed0e6 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeAngularAppTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeAngularAppTest.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -35,19 +33,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular6app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -77,20 +78,23 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular6app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand("mkdir -p node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -120,7 +124,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -143,20 +147,23 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular6app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) - .AddCommand($"mkdir -p {appDir}/node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"mkdir -p {appOutputDir}/node_modules") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -186,7 +193,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -209,21 +216,24 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular6app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}" + + $" --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand("mkdir -p /tmp/abcd") .AddCommand("ln -sfn /tmp/abcd ./node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -253,7 +263,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -276,21 +286,24 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular6app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}" + + $" --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand("mkdir -p /tmp/abcd") - .AddCommand($"ln -sfn /tmp/abcd {appDir}/node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"ln -sfn /tmp/abcd {appOutputDir}/node_modules") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -320,7 +333,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -341,9 +354,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "8"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular6app"; var volume = CreateAppVolume(appName); @@ -424,9 +435,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "9.4"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular6app"; var volume = CreateAppVolume(appName); @@ -509,9 +518,7 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular6app"; var volume = CreateAppVolume(appName); @@ -562,19 +569,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular8app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -604,20 +614,23 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular8app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand("mkdir -p node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -648,7 +661,7 @@ namespace Microsoft.Oryx.Integration.Tests var restartScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand($"cat > {appDir}/{i}.txt") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .AddFileExistsCheck($"{appDir}/{i}.txt") .ToString(); @@ -656,7 +669,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -679,21 +692,24 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "angular8app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable("PORT", PortInContainer.ToString()) .AddCommand("mkdir -p /tmp/abcd") .AddCommand("ln -sfn /tmp/abcd ./node_modules") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {PortInContainer}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {PortInContainer}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -724,7 +740,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.RunAndAssertAppAsync( imageName: _imageHelper.GetRuntimeImage("node", nodeVersion), output: _output, - volumes: new List { volume }, + volumes: new List { volume, appOutputDirVolume }, environmentVariables: null, port: PortInContainer, link: null, @@ -745,9 +761,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "10"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular8app"; var volume = CreateAppVolume(appName); @@ -827,9 +841,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "12"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular8app"; var volume = CreateAppVolume(appName); @@ -908,9 +920,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "10"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular8app"; var volume = CreateAppVolume(appName); @@ -992,9 +1002,7 @@ namespace Microsoft.Oryx.Integration.Tests var nodeVersion = "12"; string compressFormat = "tar-gz"; int count = 0; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular8app"; var volume = CreateAppVolume(appName); @@ -1076,9 +1084,7 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "angular8app"; var volume = CreateAppVolume(appName); diff --git a/tests/Oryx.Integration.Tests/Node/NodeDynamicInstallationTest.cs b/tests/Oryx.Integration.Tests/Node/NodeDynamicInstallationTest.cs index 4059b3faf..022bf59c6 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeDynamicInstallationTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeDynamicInstallationTest.cs @@ -4,9 +4,9 @@ // -------------------------------------------------------------------------------------------- using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.BuildScriptGeneratorCli; -using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -33,24 +33,27 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand(GetSnippetToCleanUpExistingInstallation()) .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable(SettingsKeys.EnableDynamicInstall, true.ToString()) - .AddCommand($"oryx setupEnv -appPath {appDir}") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx setupEnv -appPath {appOutputDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/sh", new[] @@ -83,23 +86,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand(GetSnippetToCleanUpExistingInstallation()) .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable(SettingsKeys.EnableDynamicInstall, true.ToString()) - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/sh", new[] diff --git a/tests/Oryx.Integration.Tests/Node/NodeEndToEndTestsBase.cs b/tests/Oryx.Integration.Tests/Node/NodeEndToEndTestsBase.cs index 12d320bc1..6653abf08 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeEndToEndTestsBase.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeEndToEndTestsBase.cs @@ -3,8 +3,8 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.Tests.Common; using System.IO; +using Microsoft.Oryx.Tests.Common; using Xunit.Abstractions; namespace Microsoft.Oryx.Integration.Tests diff --git a/tests/Oryx.Integration.Tests/Node/NodeLegacyVersionsEndToEndTest.cs b/tests/Oryx.Integration.Tests/Node/NodeLegacyVersionsEndToEndTest.cs index e5ef208e9..e0d3206b1 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeLegacyVersionsEndToEndTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeLegacyVersionsEndToEndTest.cs @@ -3,16 +3,14 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.BuildScriptGeneratorCli; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; -using Microsoft.Oryx.BuildScriptGeneratorCli; namespace Microsoft.Oryx.Integration.Tests { @@ -32,22 +30,25 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable( SettingsKeys.DynamicInstallRootDir, BuildScriptGenerator.Constants.TemporaryInstallationDirectoryRoot) - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -75,9 +76,7 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange var compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "linxnodeexpress"; var volume = CreateAppVolume(appName); diff --git a/tests/Oryx.Integration.Tests/Node/NodeNextJsAppTest.cs b/tests/Oryx.Integration.Tests/Node/NodeNextJsAppTest.cs index c8566aa67..b81b44266 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeNextJsAppTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeNextJsAppTest.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -32,19 +30,22 @@ namespace Microsoft.Oryx.Integration.Tests var nodeVersion = "10"; var volume = CreateAppVolume(AppName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand($"export PORT={ContainerAppPort}") - .AddCommand($"oryx create-script -appPath {appDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( AppName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -72,9 +73,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "10"; string compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var volume = CreateAppVolume(AppName); var appDir = volume.ContainerDir; diff --git a/tests/Oryx.Integration.Tests/Node/NodeNuxtJsAppTest.cs b/tests/Oryx.Integration.Tests/Node/NodeNuxtJsAppTest.cs index 14ffa10e0..82e54e4b7 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeNuxtJsAppTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeNuxtJsAppTest.cs @@ -3,12 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -33,21 +31,24 @@ namespace Microsoft.Oryx.Integration.Tests var nodeVersion = "10"; var volume = CreateAppVolume(AppName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() // Note: NuxtJS needs the host to be specified this way .SetEnvironmentVariable("HOST", "0.0.0.0") .SetEnvironmentVariable("PORT", ContainerAppPort.ToString()) - .AddCommand($"oryx create-script -appPath {appDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( AppName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -75,9 +76,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var nodeVersion = "10"; string compressFormat = "zip"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var volume = CreateAppVolume(AppName); var appDir = volume.ContainerDir; diff --git a/tests/Oryx.Integration.Tests/Node/NodeOtherEndtoEndTests.cs b/tests/Oryx.Integration.Tests/Node/NodeOtherEndtoEndTests.cs index 8c9758130..cc2f9a609 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeOtherEndtoEndTests.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeOtherEndtoEndTests.cs @@ -27,11 +27,9 @@ namespace Microsoft.Oryx.Integration.Tests public async Task CanBuildAndRunNodeApp_UsingCustomManifestFileLocation() { // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; var manifestDirPath = Directory.CreateDirectory( Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var manifestDirVolume = DockerVolume.CreateMirror(manifestDirPath); var manifestDir = manifestDirVolume.ContainerDir; diff --git a/tests/Oryx.Integration.Tests/Node/NodePreRunCommandOrScriptTest.cs b/tests/Oryx.Integration.Tests/Node/NodePreRunCommandOrScriptTest.cs index e52cb2c4e..3d8cc0c0e 100644 --- a/tests/Oryx.Integration.Tests/Node/NodePreRunCommandOrScriptTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodePreRunCommandOrScriptTest.cs @@ -6,9 +6,9 @@ using System; using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.BuildScriptGenerator.Node; using Microsoft.Oryx.BuildScriptGeneratorCli; -using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -35,11 +35,12 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform nodejs --platform-version {nodeVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int --platform nodejs --platform-version {nodeVersion} -o {appOutputDir}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -69,7 +70,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] @@ -100,12 +101,14 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var preRunScriptPath = $"{appOutputDir}/prerunscript.sh"; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform nodejs --platform-version {nodeVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform nodejs --platform-version {nodeVersion}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -139,7 +142,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] @@ -170,24 +173,27 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var expectedFileInOutputDir = Guid.NewGuid().ToString("N"); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform nodejs --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform nodejs --platform-version {nodeVersion}") // Create a 'build.env' file .AddCommand( $"echo '{FilePaths.PreRunCommandEnvVarName}=\"echo > {expectedFileInOutputDir}\"' > " + - $"{appDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") + $"{appOutputDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new DockerVolume[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/sh", new[] @@ -210,7 +216,7 @@ namespace Microsoft.Oryx.Integration.Tests // Verify that the file created using the pre-run command is // in fact present in the output directory. - Assert.True(File.Exists(Path.Combine(volume.MountedHostDir, expectedFileInOutputDir))); + Assert.True(File.Exists(Path.Combine(appOutputDirVolume.MountedHostDir, expectedFileInOutputDir))); }); } } diff --git a/tests/Oryx.Integration.Tests/Node/NodeSassExampleTest.cs b/tests/Oryx.Integration.Tests/Node/NodeSassExampleTest.cs index 91100674e..28916c4df 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeSassExampleTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeSassExampleTest.cs @@ -3,10 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -30,18 +30,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "node-sass-example"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}" + + $" --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/Node/NodeTestBuildAndRunAppWithDebugger.cs b/tests/Oryx.Integration.Tests/Node/NodeTestBuildAndRunAppWithDebugger.cs index 3097f26e5..1e99036fb 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeTestBuildAndRunAppWithDebugger.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeTestBuildAndRunAppWithDebugger.cs @@ -3,13 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -30,9 +28,7 @@ namespace Microsoft.Oryx.Integration.Tests public async Task CanBuildAndRunNodeApp_WithDebugger(string nodeVersion) { // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "linxnodeexpress"; var volume = CreateAppVolume(appName); diff --git a/tests/Oryx.Integration.Tests/Node/NodeTestUsingZippedNodeModules.cs b/tests/Oryx.Integration.Tests/Node/NodeTestUsingZippedNodeModules.cs index 7ebd2b7f0..2c701fbc9 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeTestUsingZippedNodeModules.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeTestUsingZippedNodeModules.cs @@ -3,13 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; -using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -30,9 +28,7 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange var compressFormat = "tar-gz"; - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "linxnodeexpress"; var volume = CreateAppVolume(appName); @@ -80,9 +76,7 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange // Use a separate volume for output due to rsync errors - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "create-react-app-sample"; var volume = CreateAppVolume(appName); @@ -119,10 +113,8 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange // Use a separate volume for output due to rsync errors - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; var nodeVersion = "10"; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "webfrontend"; var volume = CreateAppVolume(appName); @@ -162,10 +154,8 @@ namespace Microsoft.Oryx.Integration.Tests { // Arrange // Use a separate volume for output due to rsync errors - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) - .FullName; var nodeVersion = "10"; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "node-nested-nodemodules"; var volume = CreateAppVolume(appName); @@ -179,7 +169,7 @@ namespace Microsoft.Oryx.Integration.Tests var buildScript = new ShellScriptBuilder() .AddCommand( $"oryx build {appDir} -i /tmp/int -o /tmp/out --platform {NodeConstants.PlatformName} " + - $"--platform-version {nodeVersion} -p {NodePlatform.CompressNodeModulesPropertyKey}=tar-gz"+ + $"--platform-version {nodeVersion} -p {NodePlatform.CompressNodeModulesPropertyKey}=tar-gz" + $" -p {NodePlatform.PruneDevDependenciesPropertyKey}={pruneDevDependency}") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .AddDirectoryExistsCheck($"{appOutputDir}/another-directory/node_modules") diff --git a/tests/Oryx.Integration.Tests/Node/NodeTestWithAppInsightsConfigured.cs b/tests/Oryx.Integration.Tests/Node/NodeTestWithAppInsightsConfigured.cs index f086f8952..e1b003d91 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeTestWithAppInsightsConfigured.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeTestWithAppInsightsConfigured.cs @@ -3,11 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -37,27 +37,29 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "linxnodeexpress-appinsights"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var spcifyNodeVersionCommand = $"--platform {NodeConstants.PlatformName} --platform-version=" + nodeVersion; var aIKey = appInsightKeyOrConnectionString; var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion; var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js"; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o {appDir} {spcifyNodeVersionCommand} --log-file {appDir}/1.log") - .AddDirectoryExistsCheck($"{appDir}/node_modules").ToString(); + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} {spcifyNodeVersionCommand} --log-file {appDir}/1.log") + .AddDirectoryExistsCheck($"{appOutputDir}/node_modules").ToString(); var runScript = new ShellScriptBuilder() .AddCommand($"export {aIEnabled}={agentExtensionVersionEnvValue}") .AddCommand($"export {aIKey}=asdas") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .AddFileExistsCheck($"{FilePaths.NodeGlobalModulesPath}/{FilePaths.NodeAppInsightsLoaderFileName}") - .AddStringExistsInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh") + .AddStringExistsInFileCheck(OryxAppInsightsAttachString, $"{appOutputDir}/run.sh") .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new List { volume }, + new List { volume, appOutputDirVolume }, Settings.BuildImageName, "/bin/bash", new[] @@ -99,27 +101,29 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "linxnodeexpress-appinsights"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var spcifyNodeVersionCommand = $"--platform {NodeConstants.PlatformName} --platform-version=" + nodeVersion; var aIKey = appInsightKeyOrConnectionString; var aIEnabled = ExtVarNames.UserAppInsightsAgentExtensionVersion; var OryxAppInsightsAttachString = "--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js"; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o {appDir} {spcifyNodeVersionCommand} --log-file {appDir}/1.log") - .AddDirectoryExistsCheck($"{appDir}/node_modules").ToString(); + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} {spcifyNodeVersionCommand} --log-file {appOutputDir}/1.log") + .AddDirectoryExistsCheck($"{appOutputDir}/node_modules").ToString(); var runScript = new ShellScriptBuilder() .AddCommand($"export {aIEnabled}={agentExtensionVersionEnvValue}") .AddCommand($"export {aIKey}=asdas") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .AddFileExistsCheck($"{FilePaths.NodeGlobalModulesPath}/{FilePaths.NodeAppInsightsLoaderFileName}") - .AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appDir}/run.sh") + .AddStringDoesNotExistInFileCheck(OryxAppInsightsAttachString, $"{appOutputDir}/run.sh") .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new List { volume }, + new List { volume, appOutputDirVolume }, Settings.BuildImageName, "/bin/bash", new[] diff --git a/tests/Oryx.Integration.Tests/Node/NodeWebFrontEndAppTest.cs b/tests/Oryx.Integration.Tests/Node/NodeWebFrontEndAppTest.cs index 8b0f3e2b3..c68077e87 100644 --- a/tests/Oryx.Integration.Tests/Node/NodeWebFrontEndAppTest.cs +++ b/tests/Oryx.Integration.Tests/Node/NodeWebFrontEndAppTest.cs @@ -3,13 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Node; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; -using System; -using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Node; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -31,18 +28,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -73,20 +73,23 @@ namespace Microsoft.Oryx.Integration.Tests var nodeVersion = "10"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion} " + + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion} " + $"-p {NodePlatform.PruneDevDependenciesPropertyKey}=true") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { @@ -116,21 +119,24 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "webfrontend"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var buildCommand = $"oryx build {appDir} --platform {NodeConstants.PlatformName} --platform-version {nodeVersion} " + + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; + var buildCommand = $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {NodeConstants.PlatformName} --platform-version {nodeVersion} " + $"-p {NodePlatform.PruneDevDependenciesPropertyKey}=true"; var buildScript = new ShellScriptBuilder() .AddCommand(buildCommand) .AddCommand(buildCommand) .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { diff --git a/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs b/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs index 14e64f5df..fd2fdfd0c 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs @@ -5,8 +5,8 @@ using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -35,13 +35,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); @@ -49,7 +52,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), diff --git a/tests/Oryx.Integration.Tests/Php/PhpEndToEndTestsBase.cs b/tests/Oryx.Integration.Tests/Php/PhpEndToEndTestsBase.cs index d96e2c5db..309a2a4eb 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpEndToEndTestsBase.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpEndToEndTestsBase.cs @@ -3,9 +3,8 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.Tests.Common; using System.Collections.Generic; -using System.IO; +using Microsoft.Oryx.Tests.Common; using Xunit.Abstractions; namespace Microsoft.Oryx.Integration.Tests diff --git a/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs b/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs index f955b5fdb..79838b4c4 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs @@ -5,8 +5,8 @@ using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -36,17 +36,20 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -70,20 +73,23 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var phpimageVersion = string.Concat(phpVersion, "-", "fpm"); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") - .AddCommand($"cp -rf {appDir}/* /home/site/wwwroot") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") + .AddCommand($"cp -rf {appOutputDir}/* /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs b/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs index 9e46a4755..093d1cfb6 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs @@ -5,8 +5,8 @@ using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Php; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -34,17 +34,20 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -68,13 +71,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"cp -rf {appDir}/* /home/site/wwwroot") + .AddCommand($"cp -rf {appOutputDir}/* /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); @@ -82,7 +88,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/Php/PhpGreetingsAppTest.cs b/tests/Oryx.Integration.Tests/Php/PhpGreetingsAppTest.cs index 29e93127d..526110ed6 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpGreetingsAppTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpGreetingsAppTest.cs @@ -35,17 +35,20 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform php --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform php --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath} -bindPort {ContainerPort}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -69,13 +72,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform php --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform php --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath} -bindPort {ContainerPort}") .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"cp -rf {appDir}/* /home/site/wwwroot") + .AddCommand($"cp -rf {appOutputDir}/* /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); @@ -83,7 +89,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/Php/PhpImagickExampleTest.cs b/tests/Oryx.Integration.Tests/Php/PhpImagickExampleTest.cs index 02d912f7d..f56b9d2bf 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpImagickExampleTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpImagickExampleTest.cs @@ -34,17 +34,20 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -67,13 +70,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"cp -rf {appDir}/* /home/site/wwwroot") + .AddCommand($"cp -rf {appOutputDir}/* /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); @@ -81,7 +87,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/Php/PhpPreRunCommandOrScriptTest.cs b/tests/Oryx.Integration.Tests/Php/PhpPreRunCommandOrScriptTest.cs index d93736b7b..b596d8323 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpPreRunCommandOrScriptTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpPreRunCommandOrScriptTest.cs @@ -31,15 +31,17 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; // pre-run command which writes out a file to the output/app directory var preRunCmdGeneratedFileName = Guid.NewGuid().ToString("N"); // Note that we are using MountedHostDir rather than the directory in the container. This allows us to // write an asset from this test to check the host directory itself even after the container is killed. - var expectedFileInOutput = Path.Join(volume.MountedHostDir, "myoutputdir", preRunCmdGeneratedFileName); + var expectedFileInOutput = Path.Join(appOutputDirVolume.MountedHostDir, preRunCmdGeneratedFileName); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform php --platform-version {phpVersion} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform php --platform-version {phpVersion}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -52,7 +54,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -75,7 +77,8 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; // pre-run script which writes out a file to the output/app directory var preRunScriptGeneratedFileName = Guid.NewGuid().ToString("N"); File.WriteAllText(Path.Join(volume.MountedHostDir, "prerunscript.sh"), @@ -84,10 +87,11 @@ namespace Microsoft.Oryx.Integration.Tests $"echo > {preRunScriptGeneratedFileName}\n"); // Note that we are using MountedHostDir rather than the directory in the container. This allows us to // write an asset from this test to check the host directory itself even after the container is killed. - var expectedFileInOutput = Path.Join(volume.MountedHostDir, "myoutputdir", preRunScriptGeneratedFileName); + var expectedFileInOutput = Path.Join(appOutputDirVolume.MountedHostDir, preRunScriptGeneratedFileName); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform php --platform-version {phpVersion} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int " + + $"--platform php --platform-version {phpVersion} -o {appOutputDir}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -100,7 +104,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -123,7 +127,8 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; // pre-run script which writes out a file to the output/app directory var preRunScriptGeneratedFileName = Guid.NewGuid().ToString("N"); File.WriteAllText(Path.Join(volume.MountedHostDir, "prerunscript.sh"), @@ -134,10 +139,11 @@ namespace Microsoft.Oryx.Integration.Tests $"apt list --installed > {preRunScriptGeneratedFileName}\n"); // Note that we are using MountedHostDir rather than the directory in the container. This allows us to // write an asset from this test to check the host directory itself even after the container is killed. - var expectedFileInOutput = Path.Join(volume.MountedHostDir, "myoutputdir", preRunScriptGeneratedFileName); + var expectedFileInOutput = Path.Join(appOutputDirVolume.MountedHostDir, preRunScriptGeneratedFileName); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform php --platform-version {phpVersion} -o {appOutputDir}") + .AddCommand($"oryx build {appDir} -i /tmp/int " + + $"--platform php --platform-version {phpVersion} -o {appOutputDir}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -150,7 +156,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -175,16 +181,19 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var expectedFileInOutputDir = Guid.NewGuid().ToString("N"); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") // Create a 'build.env' file .AddCommand( $"echo '{FilePaths.PreRunCommandEnvVarName}=\"echo > {expectedFileInOutputDir}\"' > " + - $"{appDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") + $"{appOutputDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); @@ -192,7 +201,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -204,7 +213,7 @@ namespace Microsoft.Oryx.Integration.Tests // Verify that the file created using the pre-run command is // in fact present in the output directory. - Assert.True(File.Exists(Path.Combine(volume.MountedHostDir, expectedFileInOutputDir))); + Assert.True(File.Exists(Path.Combine(appOutputDirVolume.MountedHostDir, expectedFileInOutputDir))); }); } } diff --git a/tests/Oryx.Integration.Tests/Php/PhpTwigExampleTest.cs b/tests/Oryx.Integration.Tests/Php/PhpTwigExampleTest.cs index c5ee3785e..56b78fedd 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpTwigExampleTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpTwigExampleTest.cs @@ -3,11 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Php; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Php; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -34,17 +34,20 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpVersion), ContainerPort, @@ -68,13 +71,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {RunScriptPath}") .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"cp -rf {appDir}/* /home/site/wwwroot") + .AddCommand($"cp -rf {appOutputDir}/* /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); @@ -82,7 +88,7 @@ namespace Microsoft.Oryx.Integration.Tests // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/Php/PhpWordPressTest.cs b/tests/Oryx.Integration.Tests/Php/PhpWordPressTest.cs index fe0332c25..a300a8c5d 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpWordPressTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpWordPressTest.cs @@ -3,14 +3,14 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Php; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System; using System.IO; using System.IO.Compression; using System.Net; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Php; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -48,19 +48,22 @@ namespace Microsoft.Oryx.Integration.Tests } var appName = "wordpress"; - var volume = DockerVolume.CreateMirror(Path.Combine(hostDir,"wordpress")); + var volume = DockerVolume.CreateMirror(Path.Combine(hostDir, "wordpress")); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpimageVersion[0]}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpimageVersion[0]}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort} -output {RunScriptPath}") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion[0]), ContainerPort, @@ -84,13 +87,16 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "php", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var phpimageVersion = phpVersion.Split("-"); // build-script to download wordpress cli and build var buildScript = new ShellScriptBuilder() .AddCommand($"cd {appDir}") .AddCommand($"./wp-cli.phar core download") - .AddCommand($"oryx build {appDir} --platform {PhpConstants.PlatformName} --platform-version {phpimageVersion[0]}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PhpConstants.PlatformName} --platform-version {phpimageVersion[0]}") .ToString(); // run script to finish wordpress configuration and run the app @@ -98,15 +104,15 @@ namespace Microsoft.Oryx.Integration.Tests .AddCommand($"cd {appDir}") .AddCommand($"chmod +x create_wordpress_db.sh && ./create_wordpress_db.sh") .AddCommand($"chmod +x configure_wordpress.sh && ./configure_wordpress.sh") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort} -output {RunScriptPath}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort} -output {RunScriptPath}") .AddCommand("mkdir -p /home/site/wwwroot") - .AddCommand($"cp -a {appDir}/. /home/site/wwwroot") + .AddCommand($"cp -a {appOutputDir}/. /home/site/wwwroot") .AddCommand(RunScriptPath) .ToString(); // Act & Assert await EndToEndTestHelper.BuildRunAndAssertAppAsync( - appName, _output, volume, + appName, _output, new[] { volume, appOutputDirVolume }, "/bin/sh", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("php", phpimageVersion[0]), ContainerPort, diff --git a/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs b/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs index 3c5f27aa0..90b480e33 100644 --- a/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs +++ b/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs @@ -38,5 +38,13 @@ namespace Microsoft.Oryx.Integration.Tests var bytes = await _httpClient.GetByteArrayAsync(url); return Encoding.UTF8.GetString(bytes); } + + protected DockerVolume CreateAppOutputDirVolume() + { + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; + var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + return appOutputDirVolume; + } } } diff --git a/tests/Oryx.Integration.Tests/Python/Python27EndToEndTests.cs b/tests/Oryx.Integration.Tests/Python/Python27EndToEndTests.cs index 577bbda61..b6583d011 100644 --- a/tests/Oryx.Integration.Tests/Python/Python27EndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/Python/Python27EndToEndTests.cs @@ -3,10 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -27,19 +27,23 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "python2-flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var startupFile = "/tmp/startup.sh"; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 2.7") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 2.7") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {startupFile} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} " + + $"-output {startupFile} -bindPort {ContainerPort}") .AddCommand(startupFile) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -68,22 +72,25 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "python2-flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; const string virtualEnvName = "antenv2.7"; var buildScript = new ShellScriptBuilder() - .AddBuildCommand($"{appDir} --platform {PythonConstants.PlatformName} --platform-version 2.7 -p virtualenv_name={virtualEnvName}") + .AddBuildCommand($"{appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 2.7 -p virtualenv_name={virtualEnvName}") .ToString(); var runScript = new ShellScriptBuilder() // Mimic the commands ran by app service in their derived image. .AddCommand("pip install gunicorn") .AddCommand("pip install flask") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/Python37EndToEndTests.cs b/tests/Oryx.Integration.Tests/Python/Python37EndToEndTests.cs index 9fb6fc827..7507e2d95 100644 --- a/tests/Oryx.Integration.Tests/Python/Python37EndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/Python/Python37EndToEndTests.cs @@ -3,13 +3,13 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -32,18 +32,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", pythonVersion), ContainerPort, @@ -64,19 +67,22 @@ namespace Microsoft.Oryx.Integration.Tests var virtualEnvName = "antenv"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -p virtualenv_name={virtualEnvName} --platform {PythonConstants.PlatformName} --platform-version 3.7") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"-p virtualenv_name={virtualEnvName} --platform {PythonConstants.PlatformName} --platform-version 3.7") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -110,9 +116,7 @@ namespace Microsoft.Oryx.Integration.Tests var virtualEnvName = "antenv"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDirPath = Directory.CreateDirectory( - Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand( @@ -159,9 +163,7 @@ namespace Microsoft.Oryx.Integration.Tests var virtualEnvName = "antenv"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDirPath = Directory.CreateDirectory( - Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var manifestDirPath = Directory.CreateDirectory( Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; @@ -213,19 +215,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "django-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.7") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.7") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"cd {appDir}") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -262,9 +266,7 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var appName = "django-app"; var volume = CreateAppVolume(appName); - var appOutputDirPath = Directory.CreateDirectory( - Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; - var appOutputDirVolume = DockerVolume.CreateMirror(appOutputDirPath); + var appOutputDirVolume = CreateAppOutputDirVolume(); var appOutputDir = appOutputDirVolume.ContainerDir; var appDir = volume.ContainerDir; const string virtualEnvName = "antenv"; diff --git a/tests/Oryx.Integration.Tests/Python/PythonBackwardCompatibilityTests.cs b/tests/Oryx.Integration.Tests/Python/PythonBackwardCompatibilityTests.cs index 75aafd80a..611e34df7 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonBackwardCompatibilityTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonBackwardCompatibilityTests.cs @@ -3,10 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -30,22 +30,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var virtualEnvName = "antenv"; var buildScript = new ShellScriptBuilder() // App should run fine even with manifest file not present - .AddCommand($"oryx build {appDir} -p packagedir={PythonConstants.DefaultTargetPackageDirectory}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"-p packagedir={PythonConstants.DefaultTargetPackageDirectory}") .AddCommand($"rm -f {appDir}/{FilePaths.BuildManifestFileName}") .AddFileDoesNotExistCheck($"{appDir}/{FilePaths.BuildManifestFileName}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -virtualEnvName {virtualEnvName} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} " + + $"-virtualEnvName {virtualEnvName} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "3.7"), @@ -73,24 +77,27 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var virtualEnvName = "antenv"; var buildScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -p virtualenv_name={virtualEnvName} --platform {PythonConstants.PlatformName} --platform-version 3.7") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"-p virtualenv_name={virtualEnvName} --platform {PythonConstants.PlatformName} --platform-version 3.7") // App should run fine even with manifest file not present - .AddCommand($"rm -f {appDir}/{FilePaths.BuildManifestFileName}") - .AddFileDoesNotExistCheck($"{appDir}/{FilePaths.BuildManifestFileName}") + .AddCommand($"rm -f {appOutputDir}/{FilePaths.BuildManifestFileName}") + .AddFileDoesNotExistCheck($"{appOutputDir}/{FilePaths.BuildManifestFileName}") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand( - $"oryx create-script -appPath {appDir} -virtualEnvName {virtualEnvName} -bindPort {ContainerPort}") + $"oryx create-script -appPath {appOutputDir} -virtualEnvName {virtualEnvName} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "3.7"), diff --git a/tests/Oryx.Integration.Tests/Python/PythonCustomStartUpCommandTest.cs b/tests/Oryx.Integration.Tests/Python/PythonCustomStartUpCommandTest.cs index e992703d9..2741b53fa 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonCustomStartUpCommandTest.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonCustomStartUpCommandTest.cs @@ -3,12 +3,9 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; -using Microsoft.Oryx.BuildScriptGenerator.Python; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -32,23 +29,27 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "http-server-py"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var startupFile = "/tmp/startup.sh"; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); // Using the custom startup script within sample app const string customStartUpScript = "customStartup.sh"; var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort} -userStartupCommand {appDir}/{customStartUpScript} -output {startupFile}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort} " + + $"-userStartupCommand {appOutputDir}/{customStartUpScript} -output {startupFile}") .AddCommand(startupFile) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -79,22 +80,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "http-server-py"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var startupFile = "/tmp/startup.sh"; // Create a custom startup command const string customStartUpCommand = "'gunicorn -w 4 myapp:app'"; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -output {startupFile} -userStartupCommand {customStartUpCommand} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -output {startupFile} " + + $"-userStartupCommand {customStartUpCommand} -bindPort {ContainerPort}") .AddCommand(startupFile) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/PythonDebuggingTests.cs b/tests/Oryx.Integration.Tests/Python/PythonDebuggingTests.cs index 9c6dffcf2..ed9e5e3b6 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonDebuggingTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonDebuggingTests.cs @@ -3,11 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; +using System.Threading.Tasks; using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; using Microsoft.Oryx.Integration.Tests.VSCodeDebugProtocol; using Microsoft.Oryx.Tests.Common; -using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -32,13 +32,16 @@ namespace Microsoft.Oryx.Integration.Tests // Arrange var appName = "flask-app"; var appVolume = CreateAppVolume(appName); + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var scriptGenDebugPortArg = debugPort.HasValue ? $"-debugPort {debugPort.Value}" : string.Empty; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appVolume.ContainerDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion} --debug") + .AddCommand($"oryx build {appVolume.ContainerDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion} --debug") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appVolume.ContainerDir} -bindPort {ContainerPort}" + + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}" + $" -debugAdapter ptvsd {scriptGenDebugPortArg} -debugWait") .AddCommand(DefaultStartupFilePath) .ToString(); @@ -46,7 +49,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - appVolume, + new[] { appVolume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", pythonVersion), debugPort.GetValueOrDefault(DefaultPtvsdPort), diff --git a/tests/Oryx.Integration.Tests/Python/PythonDjangoAppTests.cs b/tests/Oryx.Integration.Tests/Python/PythonDjangoAppTests.cs index 057d48aef..b13fcf1cd 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonDjangoAppTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonDjangoAppTests.cs @@ -3,11 +3,11 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.IO; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -28,19 +28,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "django-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; const string virtualEnvName = "antenv3.6"; var buildScript = new ShellScriptBuilder() - .AddBuildCommand($"{appDir} --platform {PythonConstants.PlatformName} --platform-version 3.6 -p virtualenv_name={virtualEnvName}") + .AddBuildCommand($"{appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.6 -p virtualenv_name={virtualEnvName}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -78,18 +81,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "django-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.6") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.6") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -128,23 +134,25 @@ namespace Microsoft.Oryx.Integration.Tests var hostDir = Path.Combine(_hostSamplesDir, "multilanguage", appName); var volume = DockerVolume.CreateMirror(hostDir); var appDir = volume.ContainerDir; - + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand($"export {BuildScriptGeneratorCli.SettingsKeys.EnableMultiPlatformBuild}=true") - .AddBuildCommand($"{appDir} --platform {PythonConstants.PlatformName} --platform-version {PythonVersions.Python37Version}") + .AddBuildCommand($"{appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {PythonVersions.Python37Version}") .ToString(); var runAppScript = new ShellScriptBuilder() // User would do this through app settings .AddCommand("export DJANGO_SETTINGS_MODULE=\"reactdjango.settings.local_base\"") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/PythonDynamicInstallationTest.cs b/tests/Oryx.Integration.Tests/Python/PythonDynamicInstallationTest.cs index e947fafc9..8d1a961e5 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonDynamicInstallationTest.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonDynamicInstallationTest.cs @@ -4,9 +4,9 @@ // -------------------------------------------------------------------------------------------- using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.BuildScriptGenerator.Python; using Microsoft.Oryx.BuildScriptGeneratorCli; -using Microsoft.Oryx.BuildScriptGenerator.Common; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -34,23 +34,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand(GetSnippetToCleanUpExistingInstallation()) .AddCommand( - $"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() - .AddCommand($"oryx setupEnv -appPath {appDir}") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx setupEnv -appPath {appOutputDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", pythonVersion), @@ -74,23 +77,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand(GetSnippetToCleanUpExistingInstallation()) .AddCommand( - $"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() - .AddCommand($"oryx setupEnv -appPath {appDir}") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx setupEnv -appPath {appOutputDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "dynamic"), @@ -112,23 +118,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand(GetSnippetToCleanUpExistingInstallation()) .AddCommand( - $"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .SetEnvironmentVariable(SettingsKeys.EnableDynamicInstall, true.ToString()) - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "dynamic"), @@ -150,24 +159,27 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var packagesDir = ".python_packages/lib/python3.7/site-packages"; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion} " + + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion} " + $"-p packagedir={packagesDir}") - .AddDirectoryExistsCheck($"{appDir}/{packagesDir}") + .AddDirectoryExistsCheck($"{appOutputDir}/{packagesDir}") .ToString(); var runScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "3.7"), diff --git a/tests/Oryx.Integration.Tests/Python/PythonEndToEndTests.cs b/tests/Oryx.Integration.Tests/Python/PythonEndToEndTests.cs index 21a5a4093..bfb440086 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonEndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonEndToEndTests.cs @@ -28,18 +28,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.6") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.6") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -68,19 +71,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "tweeter3"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .SetEnvironmentVariable(EnvironmentSettingsKeys.PostBuildCommand, "scripts/postbuild.sh") - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.7") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.7") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -111,27 +117,30 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "django-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; const string virtualEnvName = "antenv"; // Simulate apps that were built using package directory, and then virtual env var buildScript = new ShellScriptBuilder() - .AddBuildCommand($"{appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddBuildCommand($"{appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .AddBuildCommand( - $"{appDir} -p virtualenv_name={virtualEnvName} " + + $"{appDir} -i /tmp/int -o {appOutputDir} -p virtualenv_name={virtualEnvName} " + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddDirectoryDoesNotExistCheck("__oryx_packages__") .AddCommand( - $"oryx create-script -appPath {appDir} -bindPort {ContainerPort} -virtualEnvName={virtualEnvName}") + $"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort} -virtualEnvName={virtualEnvName}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", pythonVersion), @@ -169,21 +178,23 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-setup-py-requirement-txt"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddBuildCommand($"{appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddBuildCommand($"{appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand( - $"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + $"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", pythonVersion), @@ -204,18 +215,21 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -o {appDir}/output --platform {PythonConstants.PlatformName} --platform-version 3.8") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir}" + + $" --platform {PythonConstants.PlatformName} --platform-version 3.8") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir}/output -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -244,19 +258,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} -i /tmp/int -o {appDir}/output --platform {PythonConstants.PlatformName} --platform-version 3.8") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.8") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir}/output -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/PythonEndToEndTestsBase.cs b/tests/Oryx.Integration.Tests/Python/PythonEndToEndTestsBase.cs index 4de12e02a..b71e589da 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonEndToEndTestsBase.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonEndToEndTestsBase.cs @@ -3,8 +3,8 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.Tests.Common; using System.IO; +using Microsoft.Oryx.Tests.Common; using Xunit.Abstractions; namespace Microsoft.Oryx.Integration.Tests diff --git a/tests/Oryx.Integration.Tests/Python/PythonGunicornMultiWorkersTest.cs b/tests/Oryx.Integration.Tests/Python/PythonGunicornMultiWorkersTest.cs index 60569208d..0b277a521 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonGunicornMultiWorkersTest.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonGunicornMultiWorkersTest.cs @@ -27,27 +27,30 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "http-server-py"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var startupFile = "/tmp/startup.sh"; var buildScript = new ShellScriptBuilder() .SetEnvironmentVariable( ExtVarNames.PythonEnableGunicornMultiWorkersEnvVarName, "true") - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() .SetEnvironmentVariable( ExtVarNames.PythonEnableGunicornMultiWorkersEnvVarName, "true") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(startupFile) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/PythonPortEnvironmentVariableTests.cs b/tests/Oryx.Integration.Tests/Python/PythonPortEnvironmentVariableTests.cs index acc5669d6..0e09de9c2 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonPortEnvironmentVariableTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonPortEnvironmentVariableTests.cs @@ -3,10 +3,10 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.BuildScriptGenerator.Python; -using Microsoft.Oryx.BuildScriptGenerator.Common; -using Microsoft.Oryx.Tests.Common; using System.Threading.Tasks; +using Microsoft.Oryx.BuildScriptGenerator.Common; +using Microsoft.Oryx.BuildScriptGenerator.Python; +using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; @@ -27,19 +27,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.7") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.7") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand($"export PORT={ContainerPort}") - .AddCommand($"oryx create-script -appPath {appDir}") + .AddCommand($"oryx create-script -appPath {appOutputDir}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -68,19 +71,22 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version 3.7") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version 3.7") .ToString(); var runScript = new ShellScriptBuilder() .AddCommand($"export PORT=9095") - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { diff --git a/tests/Oryx.Integration.Tests/Python/PythonPreRunCommandOrScriptTest.cs b/tests/Oryx.Integration.Tests/Python/PythonPreRunCommandOrScriptTest.cs index 5602116c4..fa05c9869 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonPreRunCommandOrScriptTest.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonPreRunCommandOrScriptTest.cs @@ -35,11 +35,13 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform python --platform-version {pythonVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int " + + $"--platform python --platform-version {pythonVersion} -o {appOutputDir}") .ToString(); // split run script to test pre-run command or script and then run the app @@ -69,7 +71,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "dynamic"), @@ -91,12 +93,14 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; - var appOutputDir = $"{appDir}/myoutputdir"; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var preRunScriptPath = $"{appOutputDir}/prerunscript.sh"; var buildScript = new ShellScriptBuilder() .AddDefaultTestEnvironmentVariables() .AddCommand( - $"oryx build {appDir} --platform python --platform-version {pythonVersion} -o {appOutputDir}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform python --platform-version {pythonVersion}") .ToString(); // split run script to test pre-run command and then run the app @@ -132,7 +136,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new[] { volume }, + new[] { volume, appOutputDirVolume }, _imageHelper.GetGitHubActionsBuildImage(), "/bin/bash", new[] { "-c", buildScript }, _imageHelper.GetRuntimeImage("python", "dynamic"), @@ -154,23 +158,26 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var expectedFileInOutputDir = Guid.NewGuid().ToString("N"); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {version}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {version}") // Create a 'build.env' file .AddCommand( $"echo '{FilePaths.PreRunCommandEnvVarName}=\"echo > {expectedFileInOutputDir}\"' > " + - $"{appDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") + $"{appOutputDir}/{BuildScriptGeneratorCli.Constants.BuildEnvironmentFileName}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - new DockerVolume[] { volume }, + new DockerVolume[] { volume, appOutputDirVolume }, _imageHelper.GetLtsVersionsBuildImage(), "/bin/bash", new[] @@ -193,7 +200,7 @@ namespace Microsoft.Oryx.Integration.Tests // Verify that the file created using the pre-run command is // in fact present in the output directory. - Assert.True(File.Exists(Path.Combine(volume.MountedHostDir, expectedFileInOutputDir))); + Assert.True(File.Exists(Path.Combine(appOutputDirVolume.MountedHostDir, expectedFileInOutputDir))); }); } } diff --git a/tests/Oryx.Integration.Tests/Python/PythonShapelyAppTests.cs b/tests/Oryx.Integration.Tests/Python/PythonShapelyAppTests.cs index 103bb7495..35c912af3 100644 --- a/tests/Oryx.Integration.Tests/Python/PythonShapelyAppTests.cs +++ b/tests/Oryx.Integration.Tests/Python/PythonShapelyAppTests.cs @@ -28,11 +28,14 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "shapely-flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") + .AddCommand($"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); var imageVersion = _imageHelper.GetRuntimeImage("python", pythonVersion); @@ -40,7 +43,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] { @@ -71,12 +74,15 @@ namespace Microsoft.Oryx.Integration.Tests var appName = "shapely-flask-app"; var volume = CreateAppVolume(appName); var appDir = volume.ContainerDir; + var appOutputDirVolume = CreateAppOutputDirVolume(); + var appOutputDir = appOutputDirVolume.ContainerDir; var buildScript = new ShellScriptBuilder() .AddCommand( - $"oryx build {appDir} --platform {PythonConstants.PlatformName} --platform-version {pythonVersion} -p packagedir={packageDir}") + $"oryx build {appDir} -i /tmp/int -o {appOutputDir} " + + $"--platform {PythonConstants.PlatformName} --platform-version {pythonVersion} -p packagedir={packageDir}") .ToString(); var runScript = new ShellScriptBuilder() - .AddCommand($"oryx create-script -appPath {appDir} -bindPort {ContainerPort}") + .AddCommand($"oryx create-script -appPath {appOutputDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); var imageVersion = _imageHelper.GetRuntimeImage("python", pythonVersion); @@ -84,7 +90,7 @@ namespace Microsoft.Oryx.Integration.Tests await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, - volume, + new[] { volume, appOutputDirVolume }, "/bin/bash", new[] {