diff --git a/build.sh b/build.sh index c3d584d88b..d761cfc9f3 100755 --- a/build.sh +++ b/build.sh @@ -26,7 +26,6 @@ $testScriptGeneratorScript "$@" $testBuildImagesScript "$@" $testRuntimeImagesScript "$@" -# Test on AKS $testIntegrationScript "$@" # Test the Node.JS startup script generator diff --git a/build/test-integration.sh b/build/test-integration.sh index e41d8b8d33..abf1c3b32c 100755 --- a/build/test-integration.sh +++ b/build/test-integration.sh @@ -9,11 +9,10 @@ set -e declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd ) source $REPO_DIR/build/__variables.sh -# if [ -z "$STORAGEACCOUNTKEY" ]; then # If STORAGEACCOUNTKEY is unset or empty -# export STORAGEACCOUNTKEY=`az.cmd storage account keys list -n oryxautomation | grep key1 | awk '{print $NF}'` -# fi - -testCaseFilter=${1:-'Category!=AKS'} +if [ -n "$1" ] +then + testCaseFilter="--filter $1" +fi echo echo "Running integration tests with filter '$testCaseFilter'..." @@ -21,4 +20,8 @@ echo testProjectName="Oryx.Integration.Tests" cd "$TESTS_SRC_DIR/$testProjectName" -dotnet test --filter $testCaseFilter --test-adapter-path:. --logger:"xunit;LogFilePath=$ARTIFACTS_DIR/testResults/$testProjectName.xml" -c $BUILD_CONFIGURATION +dotnet test \ + $testCaseFilter \ + --test-adapter-path:. \ + --logger:"xunit;LogFilePath=$ARTIFACTS_DIR/testResults/$testProjectName.xml" \ + -c $BUILD_CONFIGURATION diff --git a/doc/architecture.md b/doc/architecture.md index b48dcbed18..bf3bd6af0b 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -57,17 +57,6 @@ The following are required to run and test this project locally. - go 1.11+ (for startup script generator) - docker v18.06.1-ce -#### Additional requirements for tests - -- [az CLI](https://github.com/Azure/azure-cli) -- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - -> **NOTE:** You must set credentials for connecting to a Kubernetes cluster in -> `.kube/config` prior to running tests. If using Azure Kubernetes service, -> just run this command: `az aks get-credentials -g -n -> `. - - # Go (Golang) The startup script generator is written in Go to reduce storage space diff --git a/tests/Oryx.Integration.Tests/AksTests/SampleAppsTest.cs b/tests/Oryx.Integration.Tests/AksTests/SampleAppsTest.cs deleted file mode 100644 index 1343c2cc05..0000000000 --- a/tests/Oryx.Integration.Tests/AksTests/SampleAppsTest.cs +++ /dev/null @@ -1,253 +0,0 @@ -// -------------------------------------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -// -------------------------------------------------------------------------------------------- - -using k8s; -using k8s.Models; -using Microsoft.Rest; -using Microsoft.WindowsAzure.Storage; -using Microsoft.WindowsAzure.Storage.File; -using System; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.Oryx.Integration.Tests.AksTests -{ - public class SampleAppsTests : IClassFixture - { - private readonly ITestOutputHelper _output; - - private static readonly string STORAGE_KEY_VAR = "STORAGEACCOUNTKEY"; - private static readonly string BUILD_NUMBER_VAR = "BUILD_BUILDNUMBER"; - private static readonly string KUBECONFIG_VAR = "KUBECONFIG"; - - private static readonly string NAMESPACE = "default"; - private static readonly string BUILD_POD_NAME = "builder"; - private static readonly string VOLUME_NAME = "samples"; - private static readonly string STORAGE_ACCOUNT_NAME = "oryxautomation"; - private static readonly string STORAGE_SHARE_NAME = "oryx"; - private static readonly string STORAGE_REQUESTED_CAPACITY = "1Gi"; - - private SampleAppsFixture fixture; - - private static HttpClient httpClient = new HttpClient(); - - public SampleAppsTests(ITestOutputHelper output, SampleAppsFixture fixture) - { - _output = output; - this.fixture = fixture; - } - - public class SampleAppsFixture : IDisposable - { - private CloudFileShare fileShare; - private V1PersistentVolume storage; - private V1PersistentVolumeClaim storageClaim; - - public SampleAppsFixture() - { - BuildNumber = Environment.GetEnvironmentVariable(BUILD_NUMBER_VAR) ?? Guid.NewGuid().ToString(); - BuildNumber = BuildNumber.Replace('.', '_'); // Dots are invalid in Kubernetes service names - - var storageKey = Environment.GetEnvironmentVariable(STORAGE_KEY_VAR); - Console.WriteLine("Using storage key \"{0}...\" from environment variable \"{1}\"", storageKey.Substring(0, 4), STORAGE_KEY_VAR); - - FolderName = "SampleApps-" + BuildNumber; - - fileShare = CloudStorageAccount.Parse($"DefaultEndpointsProtocol=https;AccountName={STORAGE_ACCOUNT_NAME};AccountKey={storageKey};EndpointSuffix=core.windows.net") - .CreateCloudFileClient() - .GetShareReference(STORAGE_SHARE_NAME); - - UploadToFileShare(fileShare, FolderName); - - KubernetesClientConfiguration config; - string kubeConfig = Environment.GetEnvironmentVariable(KUBECONFIG_VAR); - if (string.IsNullOrEmpty(kubeConfig)) - { - config = KubernetesClientConfiguration.BuildConfigFromConfigFile(); - } - else - { - byte[] configByteArray = System.Text.Encoding.UTF8.GetBytes(kubeConfig); - using (var stream = new MemoryStream(configByteArray)) - { - config = KubernetesClientConfiguration.BuildConfigFromConfigFile(stream); - } - } - Client = new Kubernetes(config); - - // Create a PV for our Azure File share and a corresponding claim if they don't already exist - // If these fail, make sure that they don't already exist in the cluster: `kubectl delete -n default pvc,pv --all` - storage = Client.CreatePersistentVolume(Specs.BuildVolume.GetSpec(VOLUME_NAME, STORAGE_REQUESTED_CAPACITY, STORAGE_SHARE_NAME)); - storageClaim = Client.CreateNamespacedPersistentVolumeClaim(Specs.BuildVolumeClaim.GetSpec(STORAGE_REQUESTED_CAPACITY), NAMESPACE); - Console.WriteLine("Created PersistentVolume and corresponding PersistentVolumeClaim"); - - // Create the build pod - var podSpec = Specs.BuildPod.GetSpec(BUILD_POD_NAME, VOLUME_NAME, storageClaim.Metadata.Name); - BuildPod = k8sHelpers.CreatePodAndWait(Client, podSpec, NAMESPACE, k8sHelpers.IsPodRunning).Result; - Console.WriteLine("Build pod is up & running"); - } - - public void Dispose() - { - Client.DeleteNamespacedPod(new V1DeleteOptions(), BUILD_POD_NAME, NAMESPACE); - Client.DeleteNamespacedPersistentVolumeClaim(new V1DeleteOptions(), storageClaim.Metadata.Name, NAMESPACE); - Client.DeletePersistentVolume(new V1DeleteOptions(), VOLUME_NAME); - Console.WriteLine("Deleted build pod, volume & volume claim"); - } - - public V1Pod BuildPod { get; } - - public string BuildNumber { get; } - - public string FolderName { get; } - - public IKubernetes Client { get; } - - private async static void UploadFolderAsync(string path, CloudFileDirectory sampleAppsFolder) - { - string[] files; - string[] directories; - - files = Directory.GetFiles(path); - foreach (string file in files) - { - //Create a reference to the filename that you will be uploading - CloudFile cloudFile = sampleAppsFolder.GetFileReference(new FileInfo(file).Name); - - using (Stream fileStream = File.OpenRead(file)) - { - await cloudFile.UploadFromStreamAsync(fileStream); - } - } - - directories = Directory.GetDirectories(path); - foreach (string directory in directories) - { - var subFolder = sampleAppsFolder.GetDirectoryReference(new DirectoryInfo(directory).Name); - await subFolder.CreateIfNotExistsAsync(); - UploadFolderAsync(directory, subFolder); - } - } - - private async static void UploadToFileShare(CloudFileShare fileShare, string folderName) - { - var rootDir = fileShare.GetRootDirectoryReference(); - var sampleAppsFolder = rootDir.GetDirectoryReference(folderName); - await sampleAppsFolder.CreateIfNotExistsAsync(); - - var hostSamplesDir = Path.Combine(Directory.GetCurrentDirectory(), "SampleApps"); - UploadFolderAsync(hostSamplesDir, sampleAppsFolder); - } - } - - [Theory, Trait("Category", "AKS")] - [InlineData("linxnodeexpress", "oryxdevms/node-4.4:latest", "nodejs", "4.4.7")] - [InlineData("webfrontend", "oryxdevms/node-8.1:latest", "nodejs", "8.1")] - [InlineData("soundcloud-ngrx", "oryxdevms/node-8.11:latest", "nodejs", "8.11")] - //[InlineData("flask-app", "oryxdevms/python-3.7.0:latest", "python", "3.7")] - public async Task CanBuildAndRunSampleApp(string appName, string runtimeImage, string language, string languageVersion) - { - V1Deployment runtimeDeployment = null; - V1Service runtimeService = null; - - try - { - var appFolder = string.Format("/mnt/samples/{0}/{1}/{2}", fixture.FolderName, language, appName); - - // execute build command on a pod with build image - var command = new[] - { - "oryx", "build", appFolder, - "-o", appFolder + "_out", - "-l", language, - "--language-version", languageVersion - }; - - Console.WriteLine("Running command in build pod: `{0}`", string.Join(' ', command)); - string buildOutput = await k8sHelpers.ExecInPodAsync(fixture.Client, fixture.BuildPod, NAMESPACE, command); - Console.WriteLine("> " + buildOutput.Replace("\n", "\n> ") + Environment.NewLine); - - // Create a deployment with runtime image and run the compiled app - var runtimeDeploymentSpec = Specs.RunTimeDeployment.GetSpec(appName + fixture.BuildNumber, appName, runtimeImage, appFolder, VOLUME_NAME, STORAGE_SHARE_NAME); - runtimeDeployment = await k8sHelpers.CreateDeploymentAndWait(fixture.Client, runtimeDeploymentSpec, NAMESPACE, dep => - { - string minAvailabilityStatus = dep.Status.Conditions.Where(cond => string.Equals(cond.Type, "Available")).First()?.Status; - Console.WriteLine("Deployment's minAvailabilityStatus = {0}", minAvailabilityStatus); - return string.Equals(minAvailabilityStatus, "True"); - }); - - // Create load balancer for the deployed app - runtimeService = await k8sHelpers.CreateServiceAndWait(fixture.Client, Specs.RunTimeService.GetSpec(appName + fixture.BuildNumber), NAMESPACE, - svc => svc.Status.LoadBalancer.Ingress != null && svc.Status.LoadBalancer.Ingress.Count > 0); - Console.WriteLine("Load balancer started"); - - // Ping the app to verify its availability - var appIp = runtimeService.Status.LoadBalancer.Ingress.First().Ip; - _output.WriteLine(string.Format("Your app {0} is available at {1}", appName, runtimeService.Status.LoadBalancer.Ingress.First().Ip)); - - var response = await GetUrlAsync("http://" + appIp); - Assert.True(response.IsSuccessStatusCode); - _output.WriteLine(await response.Content.ReadAsStringAsync()); - } - finally - { - if (fixture.Client != null) - { - if (runtimeDeployment != null) - { - fixture.Client.DeleteNamespacedDeployment(new V1DeleteOptions(), runtimeDeployment.Metadata.Name, NAMESPACE); - } - if (runtimeService != null) - { - fixture.Client.DeleteNamespacedService(new V1DeleteOptions(), runtimeService.Metadata.Name, NAMESPACE); - } - } - } - } - - /// - /// Executes an HTTP GET request to the given URL, with a random-interval retry mechanism. - /// - /// URL to GET - /// Maximum number of request attempts - /// HTTP response - private async static Task GetUrlAsync(string url, int retries = 4) - { - Random rand = new Random(); - Exception lastExc = null; - while (retries > 0) - { - try - { - return await httpClient.GetAsync(url); - } - catch (Exception exc) - { - if (exc is HttpRequestException || exc is OperationCanceledException) - { - lastExc = exc; - --retries; - - int interval = rand.Next(1000, 4000); - Console.WriteLine("GET failed: {0}", exc.Message); - Console.WriteLine("Retrying in {0}ms ({1} retries left)...", interval, retries); - await Task.Delay(interval); - } - else - { - Console.WriteLine("GET failed with unrecoverable error: {0}", exc.Message); - throw exc; - } - } - } - throw lastExc; - } - } -} diff --git a/tests/Oryx.Integration.Tests/AksTests/k8sHelpers.cs b/tests/Oryx.Integration.Tests/AksTests/k8sHelpers.cs deleted file mode 100644 index d416c850a6..0000000000 --- a/tests/Oryx.Integration.Tests/AksTests/k8sHelpers.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.AksTests -{ - static class k8sHelpers - { - private static readonly TimeSpan OBJECT_WAIT_TIMEOUT = TimeSpan.FromMinutes(4); - - internal static bool IsPodRunning(V1Pod pod) - { - return string.Equals(pod.Status?.Phase, "Running"); - } - - /// - /// Synchronously executes an arbitrary command in the first container of given pod. - /// - /// Kubernetes client - /// Kubernetes pod to execute command in - /// Pod's namespace in cluster - /// Shell commands to execute - /// Output of commands - internal async static Task ExecInPodAsync(IKubernetes ops, V1Pod pod, string @namespace, string[] commands) - { - var webSockTask = ops.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, @namespace, commands, pod.Spec.Containers[0].Name, - stderr: true, stdin: false, stdout: true, tty: false); - - using (var webSock = await webSockTask) - using (var demux = new StreamDemuxer(webSock)) - { - demux.Start(); - - using (var demuxStream = demux.GetStream(1, 1)) - using (StreamReader reader = new StreamReader(demuxStream)) - return await reader.ReadToEndAsync(); - } - } - - internal async static Task CreatePodAndWait(IKubernetes ops, V1Pod spec, string @namespace, Func stopPredicate) - { - var newPod = ops.CreateNamespacedPod(spec, @namespace); - Console.WriteLine("Created pod \"{0}\"", newPod.Metadata.Name); - - try - { - newPod = await WaitForNamespacedObject(ops, newPod, @namespace, stopPredicate); - } - catch (IllegalClusterStateException exc) - { - // At this point, either the object hasn't gotten to the required state, or the watcher missed a change. - // To ensure the former, we'll read the object from the cluster again. - Console.WriteLine("Watcher failed; refreshing object \"{0}\"...", newPod.Metadata.Name); - newPod = ops.ReadNamespacedPod(spec.Metadata.Name, @namespace); - if (!stopPredicate(newPod)) - throw exc; - } - - return newPod; - } - - internal async static Task CreateServiceAndWait(IKubernetes ops, V1Service spec, string @namespace, Func stopPredicate) - { - var newSvc = ops.CreateNamespacedService(spec, @namespace); - Console.WriteLine("Created service \"{0}\"", newSvc.Metadata.Name); - - try - { - newSvc = await WaitForNamespacedObject(ops, newSvc, @namespace, stopPredicate); - } - catch (IllegalClusterStateException exc) - { - // At this point, either the object hasn't gotten to the required state, or the watcher missed a change. - // To ensure the former, we'll read the object from the cluster again. - Console.WriteLine("Watcher failed; refreshing object \"{0}\"...", newSvc.Metadata.Name); - newSvc = ops.ReadNamespacedService(spec.Metadata.Name, @namespace); - if (!stopPredicate(newSvc)) - throw exc; - } - - return newSvc; - } - - internal async static Task CreateDeploymentAndWait(IKubernetes ops, V1Deployment spec, string @namespace, Func stopPredicate) - { - var newDeployment = ops.CreateNamespacedDeployment(spec, @namespace); - Console.WriteLine("Created deployment \"{0}\"", newDeployment.Metadata.Name); - - try - { - newDeployment = await WaitForNamespacedObject(ops, newDeployment, @namespace, stopPredicate); - } - catch (IllegalClusterStateException exc) - { - // At this point, either the object hasn't gotten to the required state, or the watcher missed a change. - // To ensure the former, we'll read the object from the cluster again. - Console.WriteLine("Watcher failed; refreshing object \"{0}\"...", newDeployment.Metadata.Name); - newDeployment = ops.ReadNamespacedDeployment(spec.Metadata.Name, @namespace); - if (!stopPredicate(newDeployment)) - throw exc; - } - - return newDeployment; - } - - /// - /// Watches the given object, blocking the current thread until the object is at a required state. - /// - /// Kubernetes client - /// Kubernetes object to watch - /// Namespace in which `obj` was created - /// A function that should return `true` when `obj` is at the required state - /// Most recent version of the object, as received from the Kubernetes API server - private async static Task WaitForNamespacedObject(IKubernetes ops, T obj, string @namespace, Func stopPredicate) where T : IKubernetesObject - { - EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); - bool waitHandleSignalled; - string path = GetObjectPath(obj, @namespace); - Console.WriteLine("Watching object @ \"{0}\"", path); - - T mostRecentKobject = default(T); - using (var watcher = await ops.WatchObjectAsync( - path, - timeoutSeconds: (int)OBJECT_WAIT_TIMEOUT.TotalSeconds, - onEvent: (et, updatedObj) => - { - Console.WriteLine("Received {0} event for object @ \"{1}\"", et, path); - mostRecentKobject = updatedObj; - - if (stopPredicate(updatedObj)) - { - Console.WriteLine("Predicate returned true; signalling wait handle"); - waitHandle.Set(); - } - }, - onError: exc => throw new IllegalClusterStateException("Error while watching object", exc) - )) - { - waitHandleSignalled = waitHandle.WaitOne(OBJECT_WAIT_TIMEOUT); - } - - if (!waitHandleSignalled) - throw new IllegalClusterStateException(string.Format("Wait handle was not signalled for object @ \"{0}\"", path)); - - return mostRecentKobject; - } - - private static string GetObjectPath(IKubernetesObject obj, string @namespace) - { - string prefix = "api", kind; - V1ObjectMeta meta; - - if (obj is V1Pod) - { - kind = "pods"; - meta = ((V1Pod)obj).Metadata; - } - else if (obj is V1Service) - { - kind = "services"; - meta = ((V1Service)obj).Metadata; - } - else if (obj is V1Deployment) - { - kind = "deployments"; - prefix = "apis/apps"; - meta = ((V1Deployment)obj).Metadata; - } - else - { - throw new NotSupportedException("GetObjectPath only supports Pods, Services and Deployments."); - } - - // Path structure validated against https://github.com/kubernetes-client/csharp/blob/master/src/KubernetesClient/generated/Kubernetes.Watch.cs - return $"{prefix}/v1/watch/namespaces/{@namespace}/{kind}/{meta.Name}"; - } - - public class IllegalClusterStateException : Exception - { - public IllegalClusterStateException(string msg) : base(msg) { } - public IllegalClusterStateException(string msg, Exception inner) : base(msg, inner) { } - } - } -} diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Constants.cs b/tests/Oryx.Integration.Tests/Constants.cs similarity index 95% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Constants.cs rename to tests/Oryx.Integration.Tests/Constants.cs index e94695b77d..6503d6a8e3 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/Constants.cs +++ b/tests/Oryx.Integration.Tests/Constants.cs @@ -3,7 +3,7 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { internal class Constants { diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/DatabaseTestsBase.cs b/tests/Oryx.Integration.Tests/DatabaseTestsBase.cs similarity index 91% rename from tests/Oryx.Integration.Tests/LocalDockerTests/DatabaseTestsBase.cs rename to tests/Oryx.Integration.Tests/DatabaseTestsBase.cs index 189ecf7047..7b31e38ff0 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/DatabaseTestsBase.cs +++ b/tests/Oryx.Integration.Tests/DatabaseTestsBase.cs @@ -12,7 +12,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public abstract class DatabaseTestsBase { @@ -51,7 +51,7 @@ protected async Task RunTestAsync(string language, string languageVersion, strin { runtimeImageName = $"oryxdevms/node-{languageVersion}"; } - + string link = $"{_dbFixture.DbServerContainerName}:{Constants.InternalDbLinkName}"; await EndToEndTestHelper.BuildRunAndAssertAppAsync( @@ -65,7 +65,11 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( async () => { var data = await _httpClient.GetStringAsync($"http://localhost:{_hostPort}/"); - Assert.Equal(_dbFixture.GetSampleDataAsJson(), data.Trim(), ignoreLineEndingDifferences: true, ignoreWhiteSpaceDifferences: true); + Assert.Equal( + _dbFixture.GetSampleDataAsJson(), + data.Trim(), + ignoreLineEndingDifferences: true, + ignoreWhiteSpaceDifferences: true); }); } diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/DotNetCoreEndToEndTests.cs b/tests/Oryx.Integration.Tests/DotNetCoreEndToEndTests.cs similarity index 99% rename from tests/Oryx.Integration.Tests/LocalDockerTests/DotNetCoreEndToEndTests.cs rename to tests/Oryx.Integration.Tests/DotNetCoreEndToEndTests.cs index 5c0d5d1193..3daa0e61f2 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/DotNetCoreEndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/DotNetCoreEndToEndTests.cs @@ -11,7 +11,7 @@ using Xunit.Abstractions; using ScriptGenerator = Microsoft.Oryx.BuildScriptGenerator; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public class DotNetCoreEndToEndTests : PlatformEndToEndTestsBase { @@ -542,7 +542,7 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( } [Fact] - public async Task DotNetCoreStartupScript_UsesSuppliedBindingPort_EvenIfPortEnvironmentVariableValue_IsPresent() + public async Task StartupScript_UsesSuppliedBindingPort_EvenIfPortEnvironmentVariableValue_IsPresent() { // Arrange var dotnetcoreVersion = "2.2"; @@ -686,7 +686,7 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( } [Fact] - public async Task CanBuildAndRun_NetCore21WebApp_HavingNestedProjectDirectory_WhenNotSpecifyingLanguageVersion() + public async Task CanBuildAndRun_NetCore21WebApp_HavingNestedProjectDirectory_AndNoLanguageVersionSwitch() { // Arrange var appName = "MultiWebAppRepo"; diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/DbContainerFixtureBase.cs b/tests/Oryx.Integration.Tests/Fixtures/DbContainerFixtureBase.cs similarity index 98% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/DbContainerFixtureBase.cs rename to tests/Oryx.Integration.Tests/Fixtures/DbContainerFixtureBase.cs index 6f1d2093ec..aa5bc72c7f 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/DbContainerFixtureBase.cs +++ b/tests/Oryx.Integration.Tests/Fixtures/DbContainerFixtureBase.cs @@ -10,7 +10,7 @@ using Microsoft.Oryx.Tests.Common; using Newtonsoft.Json; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests.Fixtures +namespace Microsoft.Oryx.Integration.Tests.Fixtures { public abstract class DbContainerFixtureBase : IDisposable { diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/MySqlDbContainerFixture.cs b/tests/Oryx.Integration.Tests/Fixtures/MySqlDbContainerFixture.cs similarity index 97% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/MySqlDbContainerFixture.cs rename to tests/Oryx.Integration.Tests/Fixtures/MySqlDbContainerFixture.cs index 3ded507d40..1320d22b8b 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/MySqlDbContainerFixture.cs +++ b/tests/Oryx.Integration.Tests/Fixtures/MySqlDbContainerFixture.cs @@ -9,7 +9,7 @@ using Polly; using Xunit; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests.Fixtures +namespace Microsoft.Oryx.Integration.Tests.Fixtures { public class MySqlDbContainerFixture : DbContainerFixtureBase { diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/PostgreSqlDbContainerFixture.cs b/tests/Oryx.Integration.Tests/Fixtures/PostgreSqlDbContainerFixture.cs similarity index 91% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/PostgreSqlDbContainerFixture.cs rename to tests/Oryx.Integration.Tests/Fixtures/PostgreSqlDbContainerFixture.cs index c20038e672..cef0e59889 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/PostgreSqlDbContainerFixture.cs +++ b/tests/Oryx.Integration.Tests/Fixtures/PostgreSqlDbContainerFixture.cs @@ -9,7 +9,7 @@ using Polly; using Xunit; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests.Fixtures +namespace Microsoft.Oryx.Integration.Tests.Fixtures { public class PostgreSqlDbContainerFixture : DbContainerFixtureBase { @@ -58,7 +58,9 @@ protected override void InsertSampleData() const string sqlFile = "/tmp/postgres_setup.sql"; var dbSetupScript = new ShellScriptBuilder() .CreateFile(sqlFile, GetSampleDataInsertionSql()) - .AddCommand($"PGPASSWORD={Constants.DatabaseUserPwd} psql -h localhost -d {Constants.DatabaseName} -U{Constants.DatabaseUserName} < {sqlFile}") + .AddCommand( + $"PGPASSWORD={Constants.DatabaseUserPwd} psql -h localhost " + + $"-d {Constants.DatabaseName} -U{Constants.DatabaseUserName} < {sqlFile}") .ToString(); var result = _dockerCli.Exec(DbServerContainerName, "/bin/sh", new[] { "-c", dbSetupScript }); diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/Readme.md b/tests/Oryx.Integration.Tests/Fixtures/Readme.md similarity index 100% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/Readme.md rename to tests/Oryx.Integration.Tests/Fixtures/Readme.md diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/SqlServerDbContainerFixture.cs b/tests/Oryx.Integration.Tests/Fixtures/SqlServerDbContainerFixture.cs similarity index 95% rename from tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/SqlServerDbContainerFixture.cs rename to tests/Oryx.Integration.Tests/Fixtures/SqlServerDbContainerFixture.cs index 11931439c1..9bce60b16e 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/Fixtures/SqlServerDbContainerFixture.cs +++ b/tests/Oryx.Integration.Tests/Fixtures/SqlServerDbContainerFixture.cs @@ -9,7 +9,7 @@ using Polly; using Xunit; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests.Fixtures +namespace Microsoft.Oryx.Integration.Tests.Fixtures { public class SqlServerDbContainerFixture : DbContainerFixtureBase { @@ -68,7 +68,8 @@ protected override bool WaitUntilDbServerIsUp() protected override void InsertSampleData() { const string sqlFile = "/tmp/sqlserver_setup.sql"; - string baseSqlCmd = $"/opt/mssql-tools/bin/sqlcmd -S localhost -U {DatabaseUsername} -P {Constants.DatabaseUserPwd}"; + string baseSqlCmd + = $"/opt/mssql-tools/bin/sqlcmd -S localhost -U {DatabaseUsername} -P {Constants.DatabaseUserPwd}"; var dbSetupScript = new ShellScriptBuilder() .CreateFile(sqlFile, GetSampleDataInsertionSql()) .AddCommand($"{baseSqlCmd} -Q \"CREATE DATABASE {Constants.DatabaseName};\"") diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/MySqlIntegrationTests.cs b/tests/Oryx.Integration.Tests/MySqlIntegrationTests.cs similarity index 96% rename from tests/Oryx.Integration.Tests/LocalDockerTests/MySqlIntegrationTests.cs rename to tests/Oryx.Integration.Tests/MySqlIntegrationTests.cs index 7cc977b4e2..6279696c6a 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/MySqlIntegrationTests.cs +++ b/tests/Oryx.Integration.Tests/MySqlIntegrationTests.cs @@ -8,7 +8,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { [Trait("Category", "DB")] [Trait("db", "mysql")] diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/NodeEndToEndTests.cs b/tests/Oryx.Integration.Tests/NodeEndToEndTests.cs similarity index 92% rename from tests/Oryx.Integration.Tests/LocalDockerTests/NodeEndToEndTests.cs rename to tests/Oryx.Integration.Tests/NodeEndToEndTests.cs index 0dad3cd0a3..66e043f337 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/NodeEndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/NodeEndToEndTests.cs @@ -6,14 +6,12 @@ using System; using System.Collections.Generic; using System.IO; -using System.Net.Http; -using System.Text; using System.Threading.Tasks; using Microsoft.Oryx.Tests.Common; using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public class NodeEndToEndTests : PlatformEndToEndTestsBase { @@ -39,10 +37,12 @@ public async Task CanBuildAndRunNodeApp_UsingZippedNodeModules(string compressFo // 1. Use intermediate directory(which here is local to container) to avoid errors like // "tar: node_modules/form-data: file changed as we read it" // related to zipping files on a folder which is volume mounted. - // 2. Use output directory within the container due to 'rsync' having issues with volume mounted directories + // 2. Use output directory within the container due to 'rsync' + // having issues with volume mounted directories // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "linxnodeexpress"; @@ -58,7 +58,9 @@ public async Task CanBuildAndRunNodeApp_UsingZippedNodeModules(string compressFo .ToString(); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules={compressFormat}") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules={compressFormat}") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -88,11 +90,14 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( } [Theory] - [MemberData(nameof(TestValueGenerator.GetNodeVersions_SupportDebugging), MemberType = typeof(TestValueGenerator))] + [MemberData( + nameof(TestValueGenerator.GetNodeVersions_SupportDebugging), + MemberType = typeof(TestValueGenerator))] public async Task CanBuildAndRunNodeApp_WithDebugger(string nodeVersion) { // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "linxnodeexpress"; @@ -109,7 +114,9 @@ public async Task CanBuildAndRunNodeApp_WithDebugger(string nodeVersion) .ToString(); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules=tar-gz") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules=tar-gz") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -145,10 +152,12 @@ public async Task CanBuildAndRunNodeApp_UsingZippedNodeModules_WithoutExtracting // 1. Use intermediate directory(which here is local to container) to avoid errors like // "tar: node_modules/form-data: file changed as we read it" // related to zipping files on a folder which is volume mounted. - // 2. Use output directory within the container due to 'rsync' having issues with volume mounted directories + // 2. Use output directory within the container due to 'rsync' + // having issues with volume mounted directories // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var nodeVersion = "10.14"; @@ -168,7 +177,9 @@ public async Task CanBuildAndRunNodeApp_UsingZippedNodeModules_WithoutExtracting .ToString(); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules=tar-gz") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules=tar-gz") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -204,10 +215,12 @@ public async Task CanBuildAndRunNodeApp_OnSecondBuild_AfterZippingNodeModules_In // 1. Use intermediate directory(which here is local to container) to avoid errors like // "tar: node_modules/form-data: file changed as we read it" // related to zipping files on a folder which is volume mounted. - // 2. Use output directory within the container due to 'rsync' having issues with volume mounted directories + // 2. Use output directory within the container due to 'rsync' + // having issues with volume mounted directories // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var nodeVersion = "10.14"; @@ -223,7 +236,9 @@ public async Task CanBuildAndRunNodeApp_OnSecondBuild_AfterZippingNodeModules_In .ToString(); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules=tar-gz") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules=tar-gz") .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion}") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -260,10 +275,12 @@ public async Task CanBuildAndRunNodeApp_OnSecondBuild_AfterNotZippingNodeModules // 1. Use intermediate directory(which here is local to container) to avoid errors like // "tar: node_modules/form-data: file changed as we read it" // related to zipping files on a folder which is volume mounted. - // 2. Use output directory within the container due to 'rsync' having issues with volume mounted directories + // 2. Use output directory within the container due to 'rsync' + // having issues with volume mounted directories // Arrange - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var nodeVersion = "10.14"; @@ -280,7 +297,9 @@ public async Task CanBuildAndRunNodeApp_OnSecondBuild_AfterNotZippingNodeModules var buildScript = new ShellScriptBuilder() .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion}") - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules=tar-gz") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules=tar-gz") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -674,7 +693,8 @@ public async Task Node_CreateReactAppSample_zippedNodeModules(string nodeVersion { // Arrange // Use a separate volume for output due to rsync errors - var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))).FullName; + var appOutputDirPath = Directory.CreateDirectory(Path.Combine(_tempRootDir, Guid.NewGuid().ToString("N"))) + .FullName; var appOutputDirVolume = DockerVolume.Create(appOutputDirPath); var appOutputDir = appOutputDirVolume.ContainerDir; var appName = "create-react-app-sample"; @@ -689,7 +709,9 @@ public async Task Node_CreateReactAppSample_zippedNodeModules(string nodeVersion .ToString(); var buildScript = new ShellScriptBuilder() - .AddCommand($"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs --language-version {nodeVersion} -p compress_node_modules=zip") + .AddCommand( + $"oryx build {appDir} -i /tmp/int -o /tmp/out -l nodejs " + + $"--language-version {nodeVersion} -p compress_node_modules=zip") .AddCommand($"cp -rf /tmp/out/* {appOutputDir}") .ToString(); @@ -722,7 +744,9 @@ public async Task Node_CreateReactAppSample_singleImage() var portMapping = $"{HostPort}:{ContainerPort}"; var runScript = new ShellScriptBuilder() .AddCommand($"cd {appDir}") - .AddCommand($"oryx run-script --appPath {appDir} --platform nodejs --platform-version {nodeVersion} --bindPort {ContainerPort}") + .AddCommand( + $"oryx run-script --appPath {appDir} --platform nodejs " + + $"--platform-version {nodeVersion} --bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); @@ -767,7 +791,9 @@ public async Task CanBuildAndRun_NodeExpressApp_UsingSingleImage_AndCustomScript var runScript = new ShellScriptBuilder() .AddCommand($"cd {appDir}") .AddCommand($"chmod -x ./{customStartupScriptName}") - .AddCommand($"oryx run-script --appPath {appDir} --platform nodejs --platform-version {nodeVersion} --userStartupCommand {customStartupScriptName} --debug") + .AddCommand( + $"oryx run-script --appPath {appDir} --platform nodejs " + + $"--platform-version {nodeVersion} --userStartupCommand {customStartupScriptName} --debug") .AddCommand($"./{customStartupScriptName}") .ToString(); @@ -809,7 +835,9 @@ public async Task CanBuildAndRun_NodeExpressApp_UsingSingleImage_AndCustomStartu var runScript = new ShellScriptBuilder() .AddCommand($"cd {appDir}") - .AddCommand($"oryx run-script --appPath {appDir} --platform nodejs --platform-version {nodeVersion} --userStartupCommand {customStartupScriptCommand} --debug") + .AddCommand( + $"oryx run-script --appPath {appDir} --platform nodejs " + + $"--platform-version {nodeVersion} --userStartupCommand {customStartupScriptCommand} --debug") .AddCommand(DefaultStartupFilePath) .ToString(); diff --git a/tests/Oryx.Integration.Tests/Oryx.Integration.Tests.csproj b/tests/Oryx.Integration.Tests/Oryx.Integration.Tests.csproj index 9ae95c6ece..aca6bf8262 100644 --- a/tests/Oryx.Integration.Tests/Oryx.Integration.Tests.csproj +++ b/tests/Oryx.Integration.Tests/Oryx.Integration.Tests.csproj @@ -8,11 +8,8 @@ - - - @@ -24,31 +21,6 @@ - - Never - TextTemplatingFilePreprocessor - BuildVolume.cs - - - Never - TextTemplatingFilePreprocessor - BuildVolumeClaim.cs - - - Never - TextTemplatingFilePreprocessor - BuildPod.cs - - - Never - TextTemplatingFilePreprocessor - RunTimeDeployment.cs - - - Never - TextTemplatingFilePreprocessor - RunTimeService.cs - SampleApps\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest @@ -59,32 +31,4 @@ - - - True - True - BuildPod.tt - - - True - True - BuildVolume.tt - - - True - True - BuildVolumeClaim.tt - - - True - True - RunTimeDeployment.tt - - - True - True - RunTimeService.tt - - - diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/PhpEndToEndTests.cs b/tests/Oryx.Integration.Tests/PhpEndToEndTests.cs similarity index 97% rename from tests/Oryx.Integration.Tests/LocalDockerTests/PhpEndToEndTests.cs rename to tests/Oryx.Integration.Tests/PhpEndToEndTests.cs index adb877e2f9..cbc8afa6e2 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/PhpEndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/PhpEndToEndTests.cs @@ -12,7 +12,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public class PhpEndToEndTests : PlatformEndToEndTestsBase { @@ -79,7 +79,8 @@ public async Task WordPress51(string phpVersion) { var wpZipPath = Path.Combine(_hostTempDir, "wp.zip"); webClient.DownloadFile("https://wordpress.org/wordpress-5.1.zip", wpZipPath); - ZipFile.ExtractToDirectory(wpZipPath, _hostTempDir); // The ZIP already contains a `wordpress` folder + // The ZIP already contains a `wordpress` folder + ZipFile.ExtractToDirectory(wpZipPath, _hostTempDir); } } diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/PlatformEndToEndTestsBase.cs b/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs similarity index 93% rename from tests/Oryx.Integration.Tests/LocalDockerTests/PlatformEndToEndTestsBase.cs rename to tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs index b082dc30c8..4ef8776022 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/PlatformEndToEndTestsBase.cs +++ b/tests/Oryx.Integration.Tests/PlatformEndToEndTestsBase.cs @@ -3,14 +3,13 @@ // Licensed under the MIT license. // -------------------------------------------------------------------------------------------- -using Microsoft.Oryx.Tests.Common; -using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; +using Microsoft.Oryx.Tests.Common; using Xunit; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public abstract class PlatformEndToEndTestsBase : IClassFixture { diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/PostgreSqlIntegrationTests.cs b/tests/Oryx.Integration.Tests/PostgreSqlIntegrationTests.cs similarity index 96% rename from tests/Oryx.Integration.Tests/LocalDockerTests/PostgreSqlIntegrationTests.cs rename to tests/Oryx.Integration.Tests/PostgreSqlIntegrationTests.cs index 357ed3e542..74b3905067 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/PostgreSqlIntegrationTests.cs +++ b/tests/Oryx.Integration.Tests/PostgreSqlIntegrationTests.cs @@ -8,7 +8,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { [Trait("Category", "DB")] [Trait("db", "postgres")] diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/PythonEndToEndTests.cs b/tests/Oryx.Integration.Tests/PythonEndToEndTests.cs similarity index 96% rename from tests/Oryx.Integration.Tests/LocalDockerTests/PythonEndToEndTests.cs rename to tests/Oryx.Integration.Tests/PythonEndToEndTests.cs index 5979bbb079..555ed3c64d 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/PythonEndToEndTests.cs +++ b/tests/Oryx.Integration.Tests/PythonEndToEndTests.cs @@ -11,7 +11,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { public class PythonEndToEndTests : PlatformEndToEndTestsBase { @@ -77,7 +77,10 @@ public async Task CanBuildAndRun_Python27App_UsingVirtualEnv() var appDir = volume.ContainerDir; const string virtualEnvName = "antenv2.7"; var portMapping = $"{HostPort}:{ContainerPort}"; - var script = new ShellScriptBuilder() + var buildScript = new ShellScriptBuilder() + .AddBuildCommand($"{appDir} -l python --language-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") @@ -90,15 +93,19 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, volume, - "oryx", - new[] { "build", appDir, "-l", "python", "--language-version", "2.7", "-p", $"virtualenv_name={virtualEnvName}" }, + "/bin/bash", + new[] + { + "-c", + buildScript + }, "oryxdevms/python-2.7", portMapping, "/bin/bash", new[] { "-c", - script + runScript }, async () => { @@ -397,7 +404,9 @@ public async Task BuildWithVirtualEnv_RemovesOryxPackagesDir_FromOlderBuild(stri // Simulate apps that were built using package directory, and then virtual env var buildScript = new ShellScriptBuilder() .AddBuildCommand($"{appDir} -l python --language-version {pythonVersion}") - .AddBuildCommand($"{appDir} -p virtualenv_name={virtualEnvName} -l python --language-version {pythonVersion}") + .AddBuildCommand( + $"{appDir} -p virtualenv_name={virtualEnvName} " + + $"-l python --language-version {pythonVersion}") .ToString(); var runScript = new ShellScriptBuilder() @@ -443,9 +452,12 @@ public async Task CanBuildAndRun_DjangoPython36App_UsingVirtualEnv() var appDir = volume.ContainerDir; var portMapping = $"{HostPort}:{ContainerPort}"; const string virtualEnvName = "antenv3.6"; - var script = new ShellScriptBuilder() + var buildScript = new ShellScriptBuilder() + .AddBuildCommand($"{appDir} -l python --language-version 3.6 -p virtualenv_name={virtualEnvName}") + .ToString(); + var runScript = new ShellScriptBuilder() .AddCommand($"cd {appDir}") - .AddCommand($"oryx -appPath {appDir} -bindPort {ContainerPort} -virtualEnvName={virtualEnvName}") + .AddCommand($"oryx -appPath {appDir} -bindPort {ContainerPort}") .AddCommand(DefaultStartupFilePath) .ToString(); @@ -453,15 +465,19 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( appName, _output, volume, - "oryx", - new[] { "build", appDir, "-p", $"virtualenv_name={virtualEnvName}", "-l", "python", "--language-version", "3.6" }, + "/bin/bash", + new[] + { + "-c", + buildScript + }, "oryxdevms/python-3.6", portMapping, "/bin/bash", new[] { "-c", - script + runScript }, async () => { @@ -766,7 +782,8 @@ await EndToEndTestHelper.BuildRunAndAssertAppAsync( var linkdEndIx = data.IndexOf(".js", linkStartIdx); Assert.NotEqual(-1, linkdEndIx); - // We remove 5 chars for `src="` and add 2 since we get the first char of ".js" but we want to include ".js in the string + // We remove 5 chars for `src="` and add 2 since we get the first char of ".js" + // but we want to include ".js in the string int length = linkdEndIx - linkStartIdx - 2; var link = data.Substring(linkStartIdx + 5, length); diff --git a/tests/Oryx.Integration.Tests/Specs/BuildPod.cs b/tests/Oryx.Integration.Tests/Specs/BuildPod.cs deleted file mode 100644 index 9ed6ea6339..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildPod.cs +++ /dev/null @@ -1,336 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 15.0.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - using System; - - /// - /// Class to produce the template output - /// - - #line 1 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildPod.tt" - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public partial class BuildPod : BuildPodBase - { -#line hidden - /// - /// Create the template output - /// - public virtual string TransformText() - { - this.Write("apiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n name: "); - - #line 5 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildPod.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\nspec:\r\n containers:\r\n - image: oryxdevms/build:latest\r\n name: azure\r\n co" + - "mmand: [ \"/bin/bash\", \"-c\", \"--\" ]\r\n args: [ \"while true; do sleep 30; done;\"" + - " ]\r\n volumeMounts:\r\n - name: "); - - #line 13 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildPod.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(VolumeName)); - - #line default - #line hidden - this.Write("\r\n mountPath: /mnt/samples\r\n volumes:\r\n - name: "); - - #line 16 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildPod.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(VolumeName)); - - #line default - #line hidden - this.Write("\r\n persistentVolumeClaim:\r\n claimName: "); - - #line 18 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildPod.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(VolumeClaimName)); - - #line default - #line hidden - return this.GenerationEnvironment.ToString(); - } - } - - #line default - #line hidden - #region Base class - /// - /// Base class for this transformation - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public class BuildPodBase - { - #region Fields - private global::System.Text.StringBuilder generationEnvironmentField; - private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; - private global::System.Collections.Generic.List indentLengthsField; - private string currentIndentField = ""; - private bool endsWithNewline; - private global::System.Collections.Generic.IDictionary sessionField; - #endregion - #region Properties - /// - /// The string builder that generation-time code is using to assemble generated output - /// - protected System.Text.StringBuilder GenerationEnvironment - { - get - { - if ((this.generationEnvironmentField == null)) - { - this.generationEnvironmentField = new global::System.Text.StringBuilder(); - } - return this.generationEnvironmentField; - } - set - { - this.generationEnvironmentField = value; - } - } - /// - /// The error collection for the generation process - /// - public System.CodeDom.Compiler.CompilerErrorCollection Errors - { - get - { - if ((this.errorsField == null)) - { - this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); - } - return this.errorsField; - } - } - /// - /// A list of the lengths of each indent that was added with PushIndent - /// - private System.Collections.Generic.List indentLengths - { - get - { - if ((this.indentLengthsField == null)) - { - this.indentLengthsField = new global::System.Collections.Generic.List(); - } - return this.indentLengthsField; - } - } - /// - /// Gets the current indent we use when adding lines to the output - /// - public string CurrentIndent - { - get - { - return this.currentIndentField; - } - } - /// - /// Current transformation session - /// - public virtual global::System.Collections.Generic.IDictionary Session - { - get - { - return this.sessionField; - } - set - { - this.sessionField = value; - } - } - #endregion - #region Transform-time helpers - /// - /// Write text directly into the generated output - /// - public void Write(string textToAppend) - { - if (string.IsNullOrEmpty(textToAppend)) - { - return; - } - // If we're starting off, or if the previous text ended with a newline, - // we have to append the current indent first. - if (((this.GenerationEnvironment.Length == 0) - || this.endsWithNewline)) - { - this.GenerationEnvironment.Append(this.currentIndentField); - this.endsWithNewline = false; - } - // Check if the current text ends with a newline - if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) - { - this.endsWithNewline = true; - } - // This is an optimization. If the current indent is "", then we don't have to do any - // of the more complex stuff further down. - if ((this.currentIndentField.Length == 0)) - { - this.GenerationEnvironment.Append(textToAppend); - return; - } - // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); - // If the text ends with a newline, then we should strip off the indent added at the very end - // because the appropriate indent will be added when the next time Write() is called - if (this.endsWithNewline) - { - this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); - } - else - { - this.GenerationEnvironment.Append(textToAppend); - } - } - /// - /// Write text directly into the generated output - /// - public void WriteLine(string textToAppend) - { - this.Write(textToAppend); - this.GenerationEnvironment.AppendLine(); - this.endsWithNewline = true; - } - /// - /// Write formatted text directly into the generated output - /// - public void Write(string format, params object[] args) - { - this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Write formatted text directly into the generated output - /// - public void WriteLine(string format, params object[] args) - { - this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Raise an error - /// - public void Error(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - this.Errors.Add(error); - } - /// - /// Raise a warning - /// - public void Warning(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - error.IsWarning = true; - this.Errors.Add(error); - } - /// - /// Increase the indent - /// - public void PushIndent(string indent) - { - if ((indent == null)) - { - throw new global::System.ArgumentNullException("indent"); - } - this.currentIndentField = (this.currentIndentField + indent); - this.indentLengths.Add(indent.Length); - } - /// - /// Remove the last indent that was added with PushIndent - /// - public string PopIndent() - { - string returnValue = ""; - if ((this.indentLengths.Count > 0)) - { - int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; - this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); - if ((indentLength > 0)) - { - returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); - this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); - } - } - return returnValue; - } - /// - /// Remove any indentation - /// - public void ClearIndent() - { - this.indentLengths.Clear(); - this.currentIndentField = ""; - } - #endregion - #region ToString Helpers - /// - /// Utility class to produce culture-oriented representation of an object as a string. - /// - public class ToStringInstanceHelper - { - private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; - /// - /// Gets or sets format provider to be used by ToStringWithCulture method. - /// - public System.IFormatProvider FormatProvider - { - get - { - return this.formatProviderField ; - } - set - { - if ((value != null)) - { - this.formatProviderField = value; - } - } - } - /// - /// This is called from the compile/run appdomain to convert objects within an expression block to a string - /// - public string ToStringWithCulture(object objectToConvert) - { - if ((objectToConvert == null)) - { - throw new global::System.ArgumentNullException("objectToConvert"); - } - System.Type t = objectToConvert.GetType(); - System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { - typeof(System.IFormatProvider)}); - if ((method == null)) - { - return objectToConvert.ToString(); - } - else - { - return ((string)(method.Invoke(objectToConvert, new object[] { - this.formatProviderField }))); - } - } - } - private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); - /// - /// Helper to produce culture-oriented representation of an object as a string - /// - public ToStringInstanceHelper ToStringHelper - { - get - { - return this.toStringHelperField; - } - } - #endregion - } - #endregion -} diff --git a/tests/Oryx.Integration.Tests/Specs/BuildPod.tt b/tests/Oryx.Integration.Tests/Specs/BuildPod.tt deleted file mode 100644 index 881d6c4934..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildPod.tt +++ /dev/null @@ -1,18 +0,0 @@ -<#@ template language="C#" #> -apiVersion: v1 -kind: Pod -metadata: - name: <#= Name #> -spec: - containers: - - image: oryxdevms/build:latest - name: azure - command: [ "/bin/bash", "-c", "--" ] - args: [ "while true; do sleep 30; done;" ] - volumeMounts: - - name: <#= VolumeName #> - mountPath: /mnt/samples - volumes: - - name: <#= VolumeName #> - persistentVolumeClaim: - claimName: <#= VolumeClaimName #> \ No newline at end of file diff --git a/tests/Oryx.Integration.Tests/Specs/BuildPodProps.cs b/tests/Oryx.Integration.Tests/Specs/BuildPodProps.cs deleted file mode 100644 index e3afea0a7e..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildPodProps.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - partial class BuildPod - { - private string Name; - private string VolumeName; - private string VolumeClaimName; - - public static V1Pod GetSpec(string name, string volumeName, string volumeClaimName) - { - var obj = new BuildPod - { - Name = name, - VolumeName = volumeName, - VolumeClaimName = volumeClaimName - }; - return Yaml.LoadFromString(obj.TransformText()); - } - } -} diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolume.cs b/tests/Oryx.Integration.Tests/Specs/BuildVolume.cs deleted file mode 100644 index bc2a1e2241..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolume.cs +++ /dev/null @@ -1,329 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 15.0.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - using System; - - /// - /// Class to produce the template output - /// - - #line 1 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolume.tt" - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public partial class BuildVolume : BuildVolumeBase - { -#line hidden - /// - /// Create the template output - /// - public virtual string TransformText() - { - this.Write("apiVersion: v1\r\nkind: PersistentVolume\r\nmetadata:\r\n name: "); - - #line 5 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolume.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\nspec:\r\n capacity:\r\n storage: "); - - #line 8 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolume.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Capacity)); - - #line default - #line hidden - this.Write("\r\n accessModes:\r\n - ReadWriteOnce\r\n persistentVolumeReclaimPolicy: Retain\r\n " + - " mountOptions:\r\n - mfsymlinks\r\n azureFile:\r\n secretName: storage-secret\r\n" + - " shareName: "); - - #line 16 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolume.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(AzureFileShareName)); - - #line default - #line hidden - return this.GenerationEnvironment.ToString(); - } - } - - #line default - #line hidden - #region Base class - /// - /// Base class for this transformation - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public class BuildVolumeBase - { - #region Fields - private global::System.Text.StringBuilder generationEnvironmentField; - private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; - private global::System.Collections.Generic.List indentLengthsField; - private string currentIndentField = ""; - private bool endsWithNewline; - private global::System.Collections.Generic.IDictionary sessionField; - #endregion - #region Properties - /// - /// The string builder that generation-time code is using to assemble generated output - /// - protected System.Text.StringBuilder GenerationEnvironment - { - get - { - if ((this.generationEnvironmentField == null)) - { - this.generationEnvironmentField = new global::System.Text.StringBuilder(); - } - return this.generationEnvironmentField; - } - set - { - this.generationEnvironmentField = value; - } - } - /// - /// The error collection for the generation process - /// - public System.CodeDom.Compiler.CompilerErrorCollection Errors - { - get - { - if ((this.errorsField == null)) - { - this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); - } - return this.errorsField; - } - } - /// - /// A list of the lengths of each indent that was added with PushIndent - /// - private System.Collections.Generic.List indentLengths - { - get - { - if ((this.indentLengthsField == null)) - { - this.indentLengthsField = new global::System.Collections.Generic.List(); - } - return this.indentLengthsField; - } - } - /// - /// Gets the current indent we use when adding lines to the output - /// - public string CurrentIndent - { - get - { - return this.currentIndentField; - } - } - /// - /// Current transformation session - /// - public virtual global::System.Collections.Generic.IDictionary Session - { - get - { - return this.sessionField; - } - set - { - this.sessionField = value; - } - } - #endregion - #region Transform-time helpers - /// - /// Write text directly into the generated output - /// - public void Write(string textToAppend) - { - if (string.IsNullOrEmpty(textToAppend)) - { - return; - } - // If we're starting off, or if the previous text ended with a newline, - // we have to append the current indent first. - if (((this.GenerationEnvironment.Length == 0) - || this.endsWithNewline)) - { - this.GenerationEnvironment.Append(this.currentIndentField); - this.endsWithNewline = false; - } - // Check if the current text ends with a newline - if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) - { - this.endsWithNewline = true; - } - // This is an optimization. If the current indent is "", then we don't have to do any - // of the more complex stuff further down. - if ((this.currentIndentField.Length == 0)) - { - this.GenerationEnvironment.Append(textToAppend); - return; - } - // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); - // If the text ends with a newline, then we should strip off the indent added at the very end - // because the appropriate indent will be added when the next time Write() is called - if (this.endsWithNewline) - { - this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); - } - else - { - this.GenerationEnvironment.Append(textToAppend); - } - } - /// - /// Write text directly into the generated output - /// - public void WriteLine(string textToAppend) - { - this.Write(textToAppend); - this.GenerationEnvironment.AppendLine(); - this.endsWithNewline = true; - } - /// - /// Write formatted text directly into the generated output - /// - public void Write(string format, params object[] args) - { - this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Write formatted text directly into the generated output - /// - public void WriteLine(string format, params object[] args) - { - this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Raise an error - /// - public void Error(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - this.Errors.Add(error); - } - /// - /// Raise a warning - /// - public void Warning(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - error.IsWarning = true; - this.Errors.Add(error); - } - /// - /// Increase the indent - /// - public void PushIndent(string indent) - { - if ((indent == null)) - { - throw new global::System.ArgumentNullException("indent"); - } - this.currentIndentField = (this.currentIndentField + indent); - this.indentLengths.Add(indent.Length); - } - /// - /// Remove the last indent that was added with PushIndent - /// - public string PopIndent() - { - string returnValue = ""; - if ((this.indentLengths.Count > 0)) - { - int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; - this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); - if ((indentLength > 0)) - { - returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); - this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); - } - } - return returnValue; - } - /// - /// Remove any indentation - /// - public void ClearIndent() - { - this.indentLengths.Clear(); - this.currentIndentField = ""; - } - #endregion - #region ToString Helpers - /// - /// Utility class to produce culture-oriented representation of an object as a string. - /// - public class ToStringInstanceHelper - { - private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; - /// - /// Gets or sets format provider to be used by ToStringWithCulture method. - /// - public System.IFormatProvider FormatProvider - { - get - { - return this.formatProviderField ; - } - set - { - if ((value != null)) - { - this.formatProviderField = value; - } - } - } - /// - /// This is called from the compile/run appdomain to convert objects within an expression block to a string - /// - public string ToStringWithCulture(object objectToConvert) - { - if ((objectToConvert == null)) - { - throw new global::System.ArgumentNullException("objectToConvert"); - } - System.Type t = objectToConvert.GetType(); - System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { - typeof(System.IFormatProvider)}); - if ((method == null)) - { - return objectToConvert.ToString(); - } - else - { - return ((string)(method.Invoke(objectToConvert, new object[] { - this.formatProviderField }))); - } - } - } - private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); - /// - /// Helper to produce culture-oriented representation of an object as a string - /// - public ToStringInstanceHelper ToStringHelper - { - get - { - return this.toStringHelperField; - } - } - #endregion - } - #endregion -} diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolume.tt b/tests/Oryx.Integration.Tests/Specs/BuildVolume.tt deleted file mode 100644 index 24bf1ac414..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolume.tt +++ /dev/null @@ -1,16 +0,0 @@ -<#@ template language="C#" #> -apiVersion: v1 -kind: PersistentVolume -metadata: - name: <#= Name #> -spec: - capacity: - storage: <#= Capacity #> - accessModes: - - ReadWriteOnce - persistentVolumeReclaimPolicy: Retain - mountOptions: - - mfsymlinks - azureFile: - secretName: storage-secret - shareName: <#= AzureFileShareName #> \ No newline at end of file diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.cs b/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.cs deleted file mode 100644 index bcfb436a4c..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.cs +++ /dev/null @@ -1,323 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 15.0.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - using System; - - /// - /// Class to produce the template output - /// - - #line 1 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolumeClaim.tt" - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public partial class BuildVolumeClaim : BuildVolumeClaimBase - { -#line hidden - /// - /// Create the template output - /// - public virtual string TransformText() - { - this.Write(@"apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: build-volume-claim -spec: - storageClassName: '' # No need for dynamic storage provisioning in our testing cluster - accessModes: - - ReadWriteOnce - resources: - requests: - storage: "); - - #line 12 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\BuildVolumeClaim.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Capacity)); - - #line default - #line hidden - return this.GenerationEnvironment.ToString(); - } - } - - #line default - #line hidden - #region Base class - /// - /// Base class for this transformation - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public class BuildVolumeClaimBase - { - #region Fields - private global::System.Text.StringBuilder generationEnvironmentField; - private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; - private global::System.Collections.Generic.List indentLengthsField; - private string currentIndentField = ""; - private bool endsWithNewline; - private global::System.Collections.Generic.IDictionary sessionField; - #endregion - #region Properties - /// - /// The string builder that generation-time code is using to assemble generated output - /// - protected System.Text.StringBuilder GenerationEnvironment - { - get - { - if ((this.generationEnvironmentField == null)) - { - this.generationEnvironmentField = new global::System.Text.StringBuilder(); - } - return this.generationEnvironmentField; - } - set - { - this.generationEnvironmentField = value; - } - } - /// - /// The error collection for the generation process - /// - public System.CodeDom.Compiler.CompilerErrorCollection Errors - { - get - { - if ((this.errorsField == null)) - { - this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); - } - return this.errorsField; - } - } - /// - /// A list of the lengths of each indent that was added with PushIndent - /// - private System.Collections.Generic.List indentLengths - { - get - { - if ((this.indentLengthsField == null)) - { - this.indentLengthsField = new global::System.Collections.Generic.List(); - } - return this.indentLengthsField; - } - } - /// - /// Gets the current indent we use when adding lines to the output - /// - public string CurrentIndent - { - get - { - return this.currentIndentField; - } - } - /// - /// Current transformation session - /// - public virtual global::System.Collections.Generic.IDictionary Session - { - get - { - return this.sessionField; - } - set - { - this.sessionField = value; - } - } - #endregion - #region Transform-time helpers - /// - /// Write text directly into the generated output - /// - public void Write(string textToAppend) - { - if (string.IsNullOrEmpty(textToAppend)) - { - return; - } - // If we're starting off, or if the previous text ended with a newline, - // we have to append the current indent first. - if (((this.GenerationEnvironment.Length == 0) - || this.endsWithNewline)) - { - this.GenerationEnvironment.Append(this.currentIndentField); - this.endsWithNewline = false; - } - // Check if the current text ends with a newline - if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) - { - this.endsWithNewline = true; - } - // This is an optimization. If the current indent is "", then we don't have to do any - // of the more complex stuff further down. - if ((this.currentIndentField.Length == 0)) - { - this.GenerationEnvironment.Append(textToAppend); - return; - } - // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); - // If the text ends with a newline, then we should strip off the indent added at the very end - // because the appropriate indent will be added when the next time Write() is called - if (this.endsWithNewline) - { - this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); - } - else - { - this.GenerationEnvironment.Append(textToAppend); - } - } - /// - /// Write text directly into the generated output - /// - public void WriteLine(string textToAppend) - { - this.Write(textToAppend); - this.GenerationEnvironment.AppendLine(); - this.endsWithNewline = true; - } - /// - /// Write formatted text directly into the generated output - /// - public void Write(string format, params object[] args) - { - this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Write formatted text directly into the generated output - /// - public void WriteLine(string format, params object[] args) - { - this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Raise an error - /// - public void Error(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - this.Errors.Add(error); - } - /// - /// Raise a warning - /// - public void Warning(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - error.IsWarning = true; - this.Errors.Add(error); - } - /// - /// Increase the indent - /// - public void PushIndent(string indent) - { - if ((indent == null)) - { - throw new global::System.ArgumentNullException("indent"); - } - this.currentIndentField = (this.currentIndentField + indent); - this.indentLengths.Add(indent.Length); - } - /// - /// Remove the last indent that was added with PushIndent - /// - public string PopIndent() - { - string returnValue = ""; - if ((this.indentLengths.Count > 0)) - { - int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; - this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); - if ((indentLength > 0)) - { - returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); - this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); - } - } - return returnValue; - } - /// - /// Remove any indentation - /// - public void ClearIndent() - { - this.indentLengths.Clear(); - this.currentIndentField = ""; - } - #endregion - #region ToString Helpers - /// - /// Utility class to produce culture-oriented representation of an object as a string. - /// - public class ToStringInstanceHelper - { - private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; - /// - /// Gets or sets format provider to be used by ToStringWithCulture method. - /// - public System.IFormatProvider FormatProvider - { - get - { - return this.formatProviderField ; - } - set - { - if ((value != null)) - { - this.formatProviderField = value; - } - } - } - /// - /// This is called from the compile/run appdomain to convert objects within an expression block to a string - /// - public string ToStringWithCulture(object objectToConvert) - { - if ((objectToConvert == null)) - { - throw new global::System.ArgumentNullException("objectToConvert"); - } - System.Type t = objectToConvert.GetType(); - System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { - typeof(System.IFormatProvider)}); - if ((method == null)) - { - return objectToConvert.ToString(); - } - else - { - return ((string)(method.Invoke(objectToConvert, new object[] { - this.formatProviderField }))); - } - } - } - private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); - /// - /// Helper to produce culture-oriented representation of an object as a string - /// - public ToStringInstanceHelper ToStringHelper - { - get - { - return this.toStringHelperField; - } - } - #endregion - } - #endregion -} diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.tt b/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.tt deleted file mode 100644 index 0788ba2679..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaim.tt +++ /dev/null @@ -1,12 +0,0 @@ -<#@ template language="C#" #> -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: build-volume-claim -spec: - storageClassName: '' # No need for dynamic storage provisioning in our testing cluster - accessModes: - - ReadWriteOnce - resources: - requests: - storage: <#= Capacity #> \ No newline at end of file diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaimProps.cs b/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaimProps.cs deleted file mode 100644 index 6e2b0b8077..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolumeClaimProps.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - partial class BuildVolumeClaim - { - private string Capacity; - - public static V1PersistentVolumeClaim GetSpec(string capacity) - { - var obj = new BuildVolumeClaim - { - Capacity = capacity - }; - return Yaml.LoadFromString(obj.TransformText()); - } - } -} diff --git a/tests/Oryx.Integration.Tests/Specs/BuildVolumeProps.cs b/tests/Oryx.Integration.Tests/Specs/BuildVolumeProps.cs deleted file mode 100644 index bb87ffb2cc..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/BuildVolumeProps.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - partial class BuildVolume - { - private string Name; - private string Capacity; - private string AzureFileShareName; - - public static V1PersistentVolume GetSpec(string name, string capacity, string azShareName) - { - var obj = new BuildVolume - { - Name = name, - Capacity = capacity, - AzureFileShareName = azShareName, - }; - return Yaml.LoadFromString(obj.TransformText()); - } - } -} diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.cs b/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.cs deleted file mode 100644 index fb356fe7f2..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.cs +++ /dev/null @@ -1,374 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 15.0.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - using System; - - /// - /// Class to produce the template output - /// - - #line 1 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public partial class RunTimeDeployment : RunTimeDeploymentBase - { -#line hidden - /// - /// Create the template output - /// - public virtual string TransformText() - { - this.Write("apiVersion: apps/v1\r\nkind: Deployment\r\nmetadata:\r\n name: "); - - #line 5 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\nspec:\r\n replicas: 1\r\n strategy:\r\n rollingUpdate:\r\n maxSurge: 1\r\n " + - " maxUnavailable: 1\r\n minReadySeconds: 5\r\n selector:\r\n matchLabels:\r\n a" + - "pp: "); - - #line 15 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\n template:\r\n metadata:\r\n labels:\r\n app: "); - - #line 19 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\n spec:\r\n containers:\r\n - image: "); - - #line 22 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Image)); - - #line default - #line hidden - this.Write("\r\n name: "); - - #line 23 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(AppName)); - - #line default - #line hidden - this.Write("\r\n command: [ \"/bin/bash\", \"-c\", \"--\" ]\r\n# args: [ \"while true; do " + - "sleep 30; done;\" ]\r\n args: [ \"cd "); - - #line 26 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(AppDir)); - - #line default - #line hidden - this.Write("_out && npm start\" ]\r\n volumeMounts:\r\n - name: "); - - #line 28 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(VolumeName)); - - #line default - #line hidden - this.Write("\r\n mountPath: /mnt/samples\r\n ports:\r\n - containerPort:" + - " 80\r\n volumes:\r\n - name: "); - - #line 33 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(VolumeName)); - - #line default - #line hidden - this.Write("\r\n azureFile:\r\n secretName: storage-secret\r\n shareName: " + - ""); - - #line 36 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeDeployment.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(AzureFileShareName)); - - #line default - #line hidden - return this.GenerationEnvironment.ToString(); - } - } - - #line default - #line hidden - #region Base class - /// - /// Base class for this transformation - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public class RunTimeDeploymentBase - { - #region Fields - private global::System.Text.StringBuilder generationEnvironmentField; - private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; - private global::System.Collections.Generic.List indentLengthsField; - private string currentIndentField = ""; - private bool endsWithNewline; - private global::System.Collections.Generic.IDictionary sessionField; - #endregion - #region Properties - /// - /// The string builder that generation-time code is using to assemble generated output - /// - protected System.Text.StringBuilder GenerationEnvironment - { - get - { - if ((this.generationEnvironmentField == null)) - { - this.generationEnvironmentField = new global::System.Text.StringBuilder(); - } - return this.generationEnvironmentField; - } - set - { - this.generationEnvironmentField = value; - } - } - /// - /// The error collection for the generation process - /// - public System.CodeDom.Compiler.CompilerErrorCollection Errors - { - get - { - if ((this.errorsField == null)) - { - this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); - } - return this.errorsField; - } - } - /// - /// A list of the lengths of each indent that was added with PushIndent - /// - private System.Collections.Generic.List indentLengths - { - get - { - if ((this.indentLengthsField == null)) - { - this.indentLengthsField = new global::System.Collections.Generic.List(); - } - return this.indentLengthsField; - } - } - /// - /// Gets the current indent we use when adding lines to the output - /// - public string CurrentIndent - { - get - { - return this.currentIndentField; - } - } - /// - /// Current transformation session - /// - public virtual global::System.Collections.Generic.IDictionary Session - { - get - { - return this.sessionField; - } - set - { - this.sessionField = value; - } - } - #endregion - #region Transform-time helpers - /// - /// Write text directly into the generated output - /// - public void Write(string textToAppend) - { - if (string.IsNullOrEmpty(textToAppend)) - { - return; - } - // If we're starting off, or if the previous text ended with a newline, - // we have to append the current indent first. - if (((this.GenerationEnvironment.Length == 0) - || this.endsWithNewline)) - { - this.GenerationEnvironment.Append(this.currentIndentField); - this.endsWithNewline = false; - } - // Check if the current text ends with a newline - if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) - { - this.endsWithNewline = true; - } - // This is an optimization. If the current indent is "", then we don't have to do any - // of the more complex stuff further down. - if ((this.currentIndentField.Length == 0)) - { - this.GenerationEnvironment.Append(textToAppend); - return; - } - // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); - // If the text ends with a newline, then we should strip off the indent added at the very end - // because the appropriate indent will be added when the next time Write() is called - if (this.endsWithNewline) - { - this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); - } - else - { - this.GenerationEnvironment.Append(textToAppend); - } - } - /// - /// Write text directly into the generated output - /// - public void WriteLine(string textToAppend) - { - this.Write(textToAppend); - this.GenerationEnvironment.AppendLine(); - this.endsWithNewline = true; - } - /// - /// Write formatted text directly into the generated output - /// - public void Write(string format, params object[] args) - { - this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Write formatted text directly into the generated output - /// - public void WriteLine(string format, params object[] args) - { - this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Raise an error - /// - public void Error(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - this.Errors.Add(error); - } - /// - /// Raise a warning - /// - public void Warning(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - error.IsWarning = true; - this.Errors.Add(error); - } - /// - /// Increase the indent - /// - public void PushIndent(string indent) - { - if ((indent == null)) - { - throw new global::System.ArgumentNullException("indent"); - } - this.currentIndentField = (this.currentIndentField + indent); - this.indentLengths.Add(indent.Length); - } - /// - /// Remove the last indent that was added with PushIndent - /// - public string PopIndent() - { - string returnValue = ""; - if ((this.indentLengths.Count > 0)) - { - int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; - this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); - if ((indentLength > 0)) - { - returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); - this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); - } - } - return returnValue; - } - /// - /// Remove any indentation - /// - public void ClearIndent() - { - this.indentLengths.Clear(); - this.currentIndentField = ""; - } - #endregion - #region ToString Helpers - /// - /// Utility class to produce culture-oriented representation of an object as a string. - /// - public class ToStringInstanceHelper - { - private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; - /// - /// Gets or sets format provider to be used by ToStringWithCulture method. - /// - public System.IFormatProvider FormatProvider - { - get - { - return this.formatProviderField ; - } - set - { - if ((value != null)) - { - this.formatProviderField = value; - } - } - } - /// - /// This is called from the compile/run appdomain to convert objects within an expression block to a string - /// - public string ToStringWithCulture(object objectToConvert) - { - if ((objectToConvert == null)) - { - throw new global::System.ArgumentNullException("objectToConvert"); - } - System.Type t = objectToConvert.GetType(); - System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { - typeof(System.IFormatProvider)}); - if ((method == null)) - { - return objectToConvert.ToString(); - } - else - { - return ((string)(method.Invoke(objectToConvert, new object[] { - this.formatProviderField }))); - } - } - } - private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); - /// - /// Helper to produce culture-oriented representation of an object as a string - /// - public ToStringInstanceHelper ToStringHelper - { - get - { - return this.toStringHelperField; - } - } - #endregion - } - #endregion -} diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.tt b/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.tt deleted file mode 100644 index 97cbc35790..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeDeployment.tt +++ /dev/null @@ -1,36 +0,0 @@ -<#@ template language="C#" #> -apiVersion: apps/v1 -kind: Deployment -metadata: - name: <#= Name #> -spec: - replicas: 1 - strategy: - rollingUpdate: - maxSurge: 1 - maxUnavailable: 1 - minReadySeconds: 5 - selector: - matchLabels: - app: <#= Name #> - template: - metadata: - labels: - app: <#= Name #> - spec: - containers: - - image: <#= Image #> - name: <#= AppName #> - command: [ "/bin/bash", "-c", "--" ] -# args: [ "while true; do sleep 30; done;" ] - args: [ "cd <#= AppDir #>_out && npm start" ] - volumeMounts: - - name: <#= VolumeName #> - mountPath: /mnt/samples - ports: - - containerPort: 80 - volumes: - - name: <#= VolumeName #> - azureFile: - secretName: storage-secret - shareName: <#= AzureFileShareName #> \ No newline at end of file diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeDeploymentProps.cs b/tests/Oryx.Integration.Tests/Specs/RunTimeDeploymentProps.cs deleted file mode 100644 index cf2987261b..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeDeploymentProps.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - partial class RunTimeDeployment - { - private string Name; - private string AppName; - private string Image; - private string AppDir; - private string VolumeName; - private string AzureFileShareName; - - public static V1Deployment GetSpec(string name, string appName, string image, string appDir, string volumeName, string azShareName) - { - var obj = new RunTimeDeployment - { - Name = name, - AppName = appName, - Image = image, - AppDir = appDir, - VolumeName = volumeName, - AzureFileShareName = azShareName, - }; - return Yaml.LoadFromString(obj.TransformText()); - } - } -} diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeService.cs b/tests/Oryx.Integration.Tests/Specs/RunTimeService.cs deleted file mode 100644 index 89bd090256..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeService.cs +++ /dev/null @@ -1,320 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 15.0.0.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - using System; - - /// - /// Class to produce the template output - /// - - #line 1 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeService.tt" - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public partial class RunTimeService : RunTimeServiceBase - { -#line hidden - /// - /// Create the template output - /// - public virtual string TransformText() - { - this.Write("apiVersion: v1\r\nkind: Service\r\nmetadata:\r\n name: "); - - #line 5 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeService.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - this.Write("\r\nspec:\r\n type: LoadBalancer\r\n ports:\r\n - port: 80\r\n selector:\r\n app: "); - - #line 11 "C:\Users\dorfire\source\repos\Oryx\tests\Oryx.Integration.Tests\Specs\RunTimeService.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(Name)); - - #line default - #line hidden - return this.GenerationEnvironment.ToString(); - } - } - - #line default - #line hidden - #region Base class - /// - /// Base class for this transformation - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")] - public class RunTimeServiceBase - { - #region Fields - private global::System.Text.StringBuilder generationEnvironmentField; - private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; - private global::System.Collections.Generic.List indentLengthsField; - private string currentIndentField = ""; - private bool endsWithNewline; - private global::System.Collections.Generic.IDictionary sessionField; - #endregion - #region Properties - /// - /// The string builder that generation-time code is using to assemble generated output - /// - protected System.Text.StringBuilder GenerationEnvironment - { - get - { - if ((this.generationEnvironmentField == null)) - { - this.generationEnvironmentField = new global::System.Text.StringBuilder(); - } - return this.generationEnvironmentField; - } - set - { - this.generationEnvironmentField = value; - } - } - /// - /// The error collection for the generation process - /// - public System.CodeDom.Compiler.CompilerErrorCollection Errors - { - get - { - if ((this.errorsField == null)) - { - this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); - } - return this.errorsField; - } - } - /// - /// A list of the lengths of each indent that was added with PushIndent - /// - private System.Collections.Generic.List indentLengths - { - get - { - if ((this.indentLengthsField == null)) - { - this.indentLengthsField = new global::System.Collections.Generic.List(); - } - return this.indentLengthsField; - } - } - /// - /// Gets the current indent we use when adding lines to the output - /// - public string CurrentIndent - { - get - { - return this.currentIndentField; - } - } - /// - /// Current transformation session - /// - public virtual global::System.Collections.Generic.IDictionary Session - { - get - { - return this.sessionField; - } - set - { - this.sessionField = value; - } - } - #endregion - #region Transform-time helpers - /// - /// Write text directly into the generated output - /// - public void Write(string textToAppend) - { - if (string.IsNullOrEmpty(textToAppend)) - { - return; - } - // If we're starting off, or if the previous text ended with a newline, - // we have to append the current indent first. - if (((this.GenerationEnvironment.Length == 0) - || this.endsWithNewline)) - { - this.GenerationEnvironment.Append(this.currentIndentField); - this.endsWithNewline = false; - } - // Check if the current text ends with a newline - if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) - { - this.endsWithNewline = true; - } - // This is an optimization. If the current indent is "", then we don't have to do any - // of the more complex stuff further down. - if ((this.currentIndentField.Length == 0)) - { - this.GenerationEnvironment.Append(textToAppend); - return; - } - // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); - // If the text ends with a newline, then we should strip off the indent added at the very end - // because the appropriate indent will be added when the next time Write() is called - if (this.endsWithNewline) - { - this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); - } - else - { - this.GenerationEnvironment.Append(textToAppend); - } - } - /// - /// Write text directly into the generated output - /// - public void WriteLine(string textToAppend) - { - this.Write(textToAppend); - this.GenerationEnvironment.AppendLine(); - this.endsWithNewline = true; - } - /// - /// Write formatted text directly into the generated output - /// - public void Write(string format, params object[] args) - { - this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Write formatted text directly into the generated output - /// - public void WriteLine(string format, params object[] args) - { - this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); - } - /// - /// Raise an error - /// - public void Error(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - this.Errors.Add(error); - } - /// - /// Raise a warning - /// - public void Warning(string message) - { - System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); - error.ErrorText = message; - error.IsWarning = true; - this.Errors.Add(error); - } - /// - /// Increase the indent - /// - public void PushIndent(string indent) - { - if ((indent == null)) - { - throw new global::System.ArgumentNullException("indent"); - } - this.currentIndentField = (this.currentIndentField + indent); - this.indentLengths.Add(indent.Length); - } - /// - /// Remove the last indent that was added with PushIndent - /// - public string PopIndent() - { - string returnValue = ""; - if ((this.indentLengths.Count > 0)) - { - int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; - this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); - if ((indentLength > 0)) - { - returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); - this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); - } - } - return returnValue; - } - /// - /// Remove any indentation - /// - public void ClearIndent() - { - this.indentLengths.Clear(); - this.currentIndentField = ""; - } - #endregion - #region ToString Helpers - /// - /// Utility class to produce culture-oriented representation of an object as a string. - /// - public class ToStringInstanceHelper - { - private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; - /// - /// Gets or sets format provider to be used by ToStringWithCulture method. - /// - public System.IFormatProvider FormatProvider - { - get - { - return this.formatProviderField ; - } - set - { - if ((value != null)) - { - this.formatProviderField = value; - } - } - } - /// - /// This is called from the compile/run appdomain to convert objects within an expression block to a string - /// - public string ToStringWithCulture(object objectToConvert) - { - if ((objectToConvert == null)) - { - throw new global::System.ArgumentNullException("objectToConvert"); - } - System.Type t = objectToConvert.GetType(); - System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { - typeof(System.IFormatProvider)}); - if ((method == null)) - { - return objectToConvert.ToString(); - } - else - { - return ((string)(method.Invoke(objectToConvert, new object[] { - this.formatProviderField }))); - } - } - } - private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); - /// - /// Helper to produce culture-oriented representation of an object as a string - /// - public ToStringInstanceHelper ToStringHelper - { - get - { - return this.toStringHelperField; - } - } - #endregion - } - #endregion -} diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeService.tt b/tests/Oryx.Integration.Tests/Specs/RunTimeService.tt deleted file mode 100644 index 648de4459b..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeService.tt +++ /dev/null @@ -1,11 +0,0 @@ -<#@ template language="C#" #> -apiVersion: v1 -kind: Service -metadata: - name: <#= Name #> -spec: - type: LoadBalancer - ports: - - port: 80 - selector: - app: <#= Name #> \ No newline at end of file diff --git a/tests/Oryx.Integration.Tests/Specs/RunTimeServiceProps.cs b/tests/Oryx.Integration.Tests/Specs/RunTimeServiceProps.cs deleted file mode 100644 index 11c6f416b6..0000000000 --- a/tests/Oryx.Integration.Tests/Specs/RunTimeServiceProps.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using k8s; -using k8s.Models; - -namespace Microsoft.Oryx.Integration.Tests.Specs -{ - partial class RunTimeService - { - private string Name; - - public static V1Service GetSpec(string name) - { - var obj = new RunTimeService - { - Name = name - }; - return Yaml.LoadFromString(obj.TransformText()); - } - } -} diff --git a/tests/Oryx.Integration.Tests/LocalDockerTests/SqlServerIntegrationTests.cs b/tests/Oryx.Integration.Tests/SqlServerIntegrationTests.cs similarity index 96% rename from tests/Oryx.Integration.Tests/LocalDockerTests/SqlServerIntegrationTests.cs rename to tests/Oryx.Integration.Tests/SqlServerIntegrationTests.cs index e6c3636851..c23d67e520 100644 --- a/tests/Oryx.Integration.Tests/LocalDockerTests/SqlServerIntegrationTests.cs +++ b/tests/Oryx.Integration.Tests/SqlServerIntegrationTests.cs @@ -8,7 +8,7 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.Oryx.Integration.Tests.LocalDockerTests +namespace Microsoft.Oryx.Integration.Tests { //// NOTE: //// Commenting out the tests here as the test fixture is still run and we want to avoid that as stopping the diff --git a/vsts/pipelines/_buildParallel.yml b/vsts/pipelines/_buildParallel.yml index b7af479c21..5d0db9ff7d 100644 --- a/vsts/pipelines/_buildParallel.yml +++ b/vsts/pipelines/_buildParallel.yml @@ -107,22 +107,11 @@ steps: scriptPath: ./build/build-testimage.sh condition: and(succeeded(), eq(variables['TestIntegration'], 'true')) -- task: AzureKeyVault@1 - displayName: 'Fetch storage account key from vault' - inputs: - azureSubscription: 'Oryx Build' - keyVaultName: oryx - secretsFilter: 'STORAGEACCOUNTKEY,KUBECONFIG' - condition: and(succeeded(), eq(variables['TestIntegration'], 'true')) - - task: ShellScript@2 displayName: 'Test integration' inputs: scriptPath: ./build/test-integration.sh args: $(TestIntegrationCaseFilter) - env: - STORAGEACCOUNTKEY: $(STORAGEACCOUNTKEY) - KUBECONFIG: $(KUBECONFIG) condition: and(succeeded(), eq(variables['TestIntegration'], 'true')) - task: ms-devlabs.utilitytasks.task-Shellpp.Shell++@0 diff --git a/vsts/pipelines/_buildTemplate.yml b/vsts/pipelines/_buildTemplate.yml index 65438fbc68..cfa9d732ac 100644 --- a/vsts/pipelines/_buildTemplate.yml +++ b/vsts/pipelines/_buildTemplate.yml @@ -80,21 +80,10 @@ steps: args: skipBuildingImages condition: and(succeeded(), eq(variables['TestRuntimeImages'], 'true')) -- task: AzureKeyVault@1 - displayName: 'Fetch storage account key from vault' - inputs: - azureSubscription: 'Oryx Build' - keyVaultName: oryx - secretsFilter: 'STORAGEACCOUNTKEY,KUBECONFIG' - condition: and(succeeded(), eq(variables['TestIntegration'], 'true')) - - task: ShellScript@2 displayName: 'Test integration' inputs: scriptPath: ./build/test-integration.sh - env: - STORAGEACCOUNTKEY: $(STORAGEACCOUNTKEY) - KUBECONFIG: $(KUBECONFIG) condition: and(succeeded(), eq(variables['TestIntegration'], 'true')) - task: ms-devlabs.utilitytasks.task-Shellpp.Shell++@0 diff --git a/vsts/pipelines/nightly.yml b/vsts/pipelines/nightly.yml index d508505b41..9edbd47abf 100644 --- a/vsts/pipelines/nightly.yml +++ b/vsts/pipelines/nightly.yml @@ -61,7 +61,7 @@ jobs: echo "##vso[task.setvariable variable=BuildRuntimeImages;]false" echo "##vso[task.setvariable variable=TestBuildImages;]false" echo "##vso[task.setvariable variable=TestRuntimeImages;]false" - echo "##vso[task.setvariable variable=TestIntegrationCaseFilter;]Category!=AKS&Category!=DB" + echo "##vso[task.setvariable variable=TestIntegrationCaseFilter;]Category!=DB" echo "##vso[task.setvariable variable=TestIntegration;]true" echo "##vso[task.setvariable variable=PushBuildImages;]false" echo "##vso[task.setvariable variable=PushRuntimeImages;]false"