Exemplo n.º 1
0
        public void VerifyDockerfileTemplates()
        {
            string generateDockerfilesScript = Path.Combine(Config.SourceRepoRoot, "eng", "dockerfile-templates", "Get-GeneratedDockerfiles.ps1");
            string powershellArgs            = $"-File {generateDockerfilesScript} -Validate";

            (Process Process, string StdOut, string StdErr)executeResult;

            // Support both execution within Windows 10, Nano Server and Linux environments.
            try
            {
                executeResult = ExecuteHelper.ExecuteProcess("pwsh", powershellArgs, OutputHelper);
            }
            catch (Win32Exception)
            {
                executeResult = ExecuteHelper.ExecuteProcess("powershell", powershellArgs, OutputHelper);
            }

            if (executeResult.Process.ExitCode != 0)
            {
                OutputHelper.WriteLine(
                    $"The Dockerfiles are out of sync with the templates.  Update the Dockerfiles by running `{generateDockerfilesScript}`.");
            }

            Assert.Equal(0, executeResult.Process.ExitCode);
        }
Exemplo n.º 2
0
        private void ValidateGeneratedArtifacts(string generateScriptPath, string errorMessage)
        {
            string powershellArgs = $"-File {generateScriptPath} -Validate";

            (Process Process, string StdOut, string StdErr)executeResult;

            // Support both execution within Windows 10, Nano Server and Linux environments.
            try
            {
                executeResult = ExecuteHelper.ExecuteProcess("pwsh", powershellArgs, OutputHelper);
            }
            catch (Win32Exception)
            {
                executeResult = ExecuteHelper.ExecuteProcess("powershell", powershellArgs, OutputHelper);
            }

            if (executeResult.Process.ExitCode != 0)
            {
                OutputHelper.WriteLine(errorMessage);
            }

            Assert.Equal(0, executeResult.Process.ExitCode);
        }