Beispiel #1
0
        public void ArgumentPropertyTest(string language, string version,
                                         bool expectedRunOryxBuild, bool expectedSkipKuduSync, BuildOptimizationsFlags expectedFlags)
        {
            var mockedEnvironment = new Dictionary <string, string>()
            {
                { "FRAMEWORK", language },
                { "FRAMEWORK_VERSION", version }
            };

            using (new TestScopedEnvironmentVariable(mockedEnvironment))
            {
                IOryxArguments args = new AppServiceOryxArguments();
                Assert.Equal(expectedRunOryxBuild, args.RunOryxBuild);
                Assert.Equal(expectedSkipKuduSync, args.SkipKuduSync);
                Assert.Equal(expectedFlags, args.Flags);
            }
        }
Beispiel #2
0
        public void DefaultTest()
        {
            IOryxArguments args = new AppServiceOryxArguments();

            Assert.False(args.RunOryxBuild);
            Assert.False(args.SkipKuduSync);
            Assert.Equal(BuildOptimizationsFlags.Off, args.Flags);

            var mockedContext = new DeploymentContext()
            {
                RepositoryPath = "RepositoryPath",
                BuildTempPath  = "BuildTempPath",
                OutputPath     = "OutputPath"
            };
            string command = args.GenerateOryxBuildCommand(mockedContext);

            Assert.Equal("oryx build OutputPath -o OutputPath", command);
        }
Beispiel #3
0
        public void DotnetcoreVersionPromotionTest(string version, string expectedCommand)
        {
            var mockedEnvironment = new Dictionary <string, string>()
            {
                { "FRAMEWORK", "DOTNETCORE" },
                { "FRAMEWORK_VERSION", version }
            };

            var mockedContext = new DeploymentContext()
            {
                RepositoryPath = "RepositoryPath",
                BuildTempPath  = "BuildTempPath",
                OutputPath     = "OutputPath"
            };

            using (new TestScopedEnvironmentVariable(mockedEnvironment))
            {
                IOryxArguments args    = new AppServiceOryxArguments();
                string         command = args.GenerateOryxBuildCommand(mockedContext);
                Assert.Equal(expectedCommand, args.GenerateOryxBuildCommand(mockedContext));
            }
        }
Beispiel #4
0
        public void MissingOutputPathTest()
        {
            var mockedEnvironment = new Dictionary <string, string>()
            {
                { "FRAMEWORK", "PYTHON" },
                { "FRAMEWORK_VERSION", "3.6" }
            };

            var mockedContext = new DeploymentContext()
            {
                RepositoryPath = "RepositoryPath",
                BuildTempPath  = "BuildTempPath"
            };

            using (new TestScopedEnvironmentVariable(mockedEnvironment))
            {
                IOryxArguments args    = new AppServiceOryxArguments();
                string         command = args.GenerateOryxBuildCommand(mockedContext);
                Assert.Equal("oryx build  -o  --platform python --platform-version 3.6 -p virtualenv_name=antenv3.6",
                             args.GenerateOryxBuildCommand(mockedContext));
            }
        }
Beispiel #5
0
        public void MissingFrameworkEnvironmentTest()
        {
            var mockedEnvironment = new Dictionary <string, string>()
            {
                //{ "FRAMEWORK", language },
                { "FRAMEWORK_VERSION", "3.6" }
            };

            var mockedContext = new DeploymentContext()
            {
                RepositoryPath = "RepositoryPath",
                BuildTempPath  = "BuildTempPath",
                OutputPath     = "OutputPath"
            };

            using (new TestScopedEnvironmentVariable(mockedEnvironment))
            {
                IOryxArguments args    = new AppServiceOryxArguments();
                string         command = args.GenerateOryxBuildCommand(mockedContext);
                Assert.Equal("oryx build OutputPath -o OutputPath", args.GenerateOryxBuildCommand(mockedContext));
            }
        }
Beispiel #6
0
        public void NodejsUseExpressBuildTest()
        {
            var mockedEnvironment = new Dictionary <string, string>()
            {
                { "FRAMEWORK", "NODE" },
                { "FRAMEWORK_VERSION", "8.12" },
                { "BUILD_FLAGS", "UseExpressBuild" }
            };

            var mockedContext = new DeploymentContext()
            {
                RepositoryPath = "RepositoryPath",
                BuildTempPath  = "BuildTempPath",
                OutputPath     = "OutputPath"
            };

            using (new TestScopedEnvironmentVariable(mockedEnvironment))
            {
                IOryxArguments args    = new AppServiceOryxArguments();
                string         command = args.GenerateOryxBuildCommand(mockedContext);
                Assert.Equal("oryx build OutputPath -o OutputPath --platform nodejs --platform-version 8.12 -i BuildTempPath -p compress_node_modules=zip",
                             args.GenerateOryxBuildCommand(mockedContext));
            }
        }