Updated tests to use intermediate directory (#831)

This commit is contained in:
Kiran 2020-11-03 12:10:10 -08:00 коммит произвёл GitHub
Родитель 9cb821bc76
Коммит 6edb3f117d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
46 изменённых файлов: 684 добавлений и 497 удалений

Просмотреть файл

@ -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[]

Просмотреть файл

@ -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[]

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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<DockerVolume> { volume },
volumes: new List<DockerVolume> { 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);

Просмотреть файл

@ -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[]

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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)));
});
}
}

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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);

Просмотреть файл

@ -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")

Просмотреть файл

@ -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<DockerVolume> { volume },
new List<DockerVolume> { 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<DockerVolume> { volume },
new List<DockerVolume> { volume, appOutputDirVolume },
Settings.BuildImageName,
"/bin/bash",
new[]

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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),

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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)));
});
}
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}
}
}

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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";

Просмотреть файл

@ -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"),

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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),

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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"),

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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[]
{

Просмотреть файл

@ -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)));
});
}
}

Просмотреть файл

@ -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[]
{