From 64c9751269fda5e0d4a93407a59e0ed8c421ab87 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Fri, 25 Dec 2020 18:03:35 +0300 Subject: [PATCH] [Ubuntu] Migrate tests for common tools to Pester (part 3) (#2337) * add test for Git * Add Heroku * Add hhvm * Add Homebrew * Add Julia * Add kind * Add Kubernetes Tools * Remove kind and homebrew validate * replace capital letter * Add Leiningen * add source to Leiningen * Add Mercurial * Add conda * Add Netlify * Add packer * Add pollinate * Add Pulumi * Add Phantomjs * Add Haveged * Fix for kubectl * Fix julia installation * Add installer_script_folder env variable to run tests in brew provisioner * Add delay after reboot * Adjust pause settings --- .../linux/scripts/helpers/Tests.Helpers.psm1 | 36 ++++++ images/linux/scripts/installers/git.sh | 29 +---- images/linux/scripts/installers/heroku.sh | 8 +- images/linux/scripts/installers/hhvm.sh | 30 +---- .../scripts/installers/homebrew-validate.sh | 14 --- images/linux/scripts/installers/homebrew.sh | 6 +- images/linux/scripts/installers/julia.sh | 49 ++------ images/linux/scripts/installers/kind.sh | 17 --- .../scripts/installers/kubernetes-tools.sh | 32 ++--- images/linux/scripts/installers/leiningen.sh | 11 +- images/linux/scripts/installers/mercurial.sh | 8 +- images/linux/scripts/installers/miniconda.sh | 4 + images/linux/scripts/installers/netlify.sh | 9 +- images/linux/scripts/installers/packer.sh | 9 +- images/linux/scripts/installers/phantomjs.sh | 9 +- images/linux/scripts/installers/pollinate.sh | 9 +- images/linux/scripts/installers/pulumi.sh | 8 +- .../linux/scripts/installers/rndgenerator.sh | 11 +- images/linux/scripts/tests/Tools.Tests.ps1 | 118 ++++++++++++++++++ images/linux/ubuntu1604.json | 16 +-- images/linux/ubuntu1804.json | 16 +-- images/linux/ubuntu2004.json | 16 +-- 22 files changed, 227 insertions(+), 238 deletions(-) delete mode 100644 images/linux/scripts/installers/homebrew-validate.sh delete mode 100644 images/linux/scripts/installers/kind.sh diff --git a/images/linux/scripts/helpers/Tests.Helpers.psm1 b/images/linux/scripts/helpers/Tests.Helpers.psm1 index d4040e9fd..35c5ab10a 100644 --- a/images/linux/scripts/helpers/Tests.Helpers.psm1 +++ b/images/linux/scripts/helpers/Tests.Helpers.psm1 @@ -69,4 +69,40 @@ function ShouldReturnZeroExitCode { If (Get-Command -Name Add-AssertionOperator -ErrorAction SilentlyContinue) { Add-AssertionOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode} +} + +function ShouldMatchCommandOutput { + Param( + [String] $ActualValue, + [String] $RegularExpression, + [switch] $Negate + ) + + $output = (Get-CommandResult $ActualValue).Output | Out-String + [bool] $succeeded = $output -cmatch $RegularExpression + + if ($Negate) { + $succeeded = -not $succeeded + } + + $failureMessage = '' + + if (-not $succeeded) { + if ($Negate) { + $failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to not match '$output', but it did match." + } + else { + $failureMessage = "Expected regular expression '$RegularExpression' for '$ActualValue' command to match '$output', but it did not match." + } + } + + return [PSCustomObject] @{ + Succeeded = $succeeded + FailureMessage = $failureMessage + } +} + +If (Get-Command -Name Add-AssertionOperator -ErrorAction SilentlyContinue) { + Add-AssertionOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode} + Add-AssertionOperator -Name MatchCommandOutput -InternalName ShouldMatchCommandOutput -Test ${function:ShouldMatchCommandOutput} } \ No newline at end of file diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh index 90b0f10ec..74d03b017 100644 --- a/images/linux/scripts/installers/git.sh +++ b/images/linux/scripts/installers/git.sh @@ -5,7 +5,8 @@ ################################################################################ # Source the helpers for use with the script -source "$HELPER_SCRIPTS"/install.sh +source $HELPER_SCRIPTS/install.sh +source $HELPER_SCRIPTS/invoke-tests.sh ## Install git add-apt-repository ppa:git-core/ppa -y @@ -20,23 +21,6 @@ apt-get install -y --no-install-recommends git-lfs # Install git-ftp apt-get install git-ftp -y -# Run tests to determine that the software installed as expected -echo "Testing git installation" -if ! command -v git; then - echo "git was not installed" - exit 1 -fi -echo "Testing git-lfs installation" -if ! command -v git-lfs; then - echo "git-lfs was not installed" - exit 1 -fi -echo "Testing git-ftp installation" -if ! command -v git-ftp; then - echo "git-ftp was not installed" - exit 1 -fi - #Install hub tmp_hub="/tmp/hub" mkdir -p "$tmp_hub" @@ -45,13 +29,8 @@ download_with_retries "$url" "$tmp_hub" tar xzvf "$tmp_hub"/hub-linux-amd64-*.tgz --strip-components 1 -C "$tmp_hub" mv "$tmp_hub"/bin/hub /usr/local/bin -if command -v hub; then - echo "hub CLI was installed successfully" -else - echo "[!] Hub CLI was not installed" - exit 1 -fi - # Add well-known SSH host keys to known_hosts ssh-keyscan -t rsa github.com >> /etc/ssh/ssh_known_hosts ssh-keyscan -t rsa ssh.dev.azure.com >> /etc/ssh/ssh_known_hosts + +invoke_tests "Tools" "Git" \ No newline at end of file diff --git a/images/linux/scripts/installers/heroku.sh b/images/linux/scripts/installers/heroku.sh index 86d537869..12511b90a 100644 --- a/images/linux/scripts/installers/heroku.sh +++ b/images/linux/scripts/installers/heroku.sh @@ -4,11 +4,9 @@ ## Desc: Installs Heroku CLI ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install Heroku CLI curl https://cli-assets.heroku.com/install-ubuntu.sh | sh -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v heroku; then - exit 1 -fi +invoke_tests "Tools" "Heroku" \ No newline at end of file diff --git a/images/linux/scripts/installers/hhvm.sh b/images/linux/scripts/installers/hhvm.sh index e44f4b3a5..24183d3b0 100644 --- a/images/linux/scripts/installers/hhvm.sh +++ b/images/linux/scripts/installers/hhvm.sh @@ -4,29 +4,11 @@ ## Desc: Installs hhvm ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/install.sh +source $HELPER_SCRIPTS/invoke-tests.sh -hhvm_package=hhvm +apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 +add-apt-repository https://dl.hhvm.com/ubuntu +apt-get update +apt-get -qq install -y hhvm -# Test to see if the software in question is already installed, if not install it -echo "Checking to see if the installer script has already been run" -if ! IsPackageInstalled ${hhvm_package}; then - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 - add-apt-repository https://dl.hhvm.com/ubuntu - apt-get update - apt-get -qq install -y hhvm -else - echo "${hhvm_package} already installed" -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! IsPackageInstalled ${hhvm_package}; then - echo "${hhvm_package} was not installed" - exit 1 -fi - -if ! command -v hhvm; then - exit 1 -fi +invoke_tests "Tools" "HHVM" diff --git a/images/linux/scripts/installers/homebrew-validate.sh b/images/linux/scripts/installers/homebrew-validate.sh deleted file mode 100644 index 0806838d7..000000000 --- a/images/linux/scripts/installers/homebrew-validate.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -e -################################################################################ -## File: homebrew-validate.sh -## Desc: Validate the Homebrew can run after reboot without extra configuring -################################################################################ - -# Validate the installation -echo "Validate the Homebrew can run after reboot" - -if ! command -v brew; then - echo "brew executable not found after reboot" - exit 1 -fi - diff --git a/images/linux/scripts/installers/homebrew.sh b/images/linux/scripts/installers/homebrew.sh index dd9e8f9e5..5db00d994 100644 --- a/images/linux/scripts/installers/homebrew.sh +++ b/images/linux/scripts/installers/homebrew.sh @@ -7,6 +7,7 @@ # Source the helpers source $HELPER_SCRIPTS/etc-environment.sh +source $HELPER_SCRIPTS/invoke-tests.sh # Install the Homebrew on Linux /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" @@ -23,7 +24,4 @@ prependEtcEnvironmentPath "$brew_path" echo "Validate the installation reloading /etc/environment" reloadEtcEnvironment -if ! command -v brew; then - echo "brew was not installed" - exit 1 -fi +invoke_tests "Tools" "Homebrew" diff --git a/images/linux/scripts/installers/julia.sh b/images/linux/scripts/installers/julia.sh index cd0ee0ed9..5793efb53 100644 --- a/images/linux/scripts/installers/julia.sh +++ b/images/linux/scripts/installers/julia.sh @@ -4,6 +4,8 @@ ## Desc: Installs Julia, and adds Julia to the path ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # This function fetches the latest Julia release from the GitHub API # Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c function GetLatestJuliaRelease () { @@ -13,44 +15,15 @@ function GetLatestJuliaRelease () { sed 's/v//' # remove v prefix } +juliaVersion="$(GetLatestJuliaRelease)" +juliaMajorAndMinorVersion="$(cut -d. -f1,2 <<< $juliaVersion)" +juliaInstallationPath="/usr/local/julia$juliaVersion" -# This function installs Julia using the specified arguments: -# $1=MajorAndMinorVersion (1.3.1) -# $2=IsDefaultVersion (true or false) +curl -sL "https://julialang-s3.julialang.org/bin/linux/x64/$juliaMajorAndMinorVersion/julia-$juliaVersion-linux-x86_64.tar.gz" -o "julia-$juliaVersion-linux-x86_64.tar.gz" +mkdir -p "$juliaInstallationPath" +tar -C "$juliaInstallationPath" -xzf "julia-$juliaVersion-linux-x86_64.tar.gz" --strip-components=1 +rm "julia-$juliaVersion-linux-x86_64.tar.gz" -function InstallJulia () { - # Extract Major and Minor version from full version string - juliaMajorAndMinorVersion="$(cut -d. -f1,2 <<< $1)" - juliaInstallationPath="/usr/local/julia$1" +ln -s "$juliaInstallationPath/bin/julia" /usr/bin/julia - curl -sL "https://julialang-s3.julialang.org/bin/linux/x64/$juliaMajorAndMinorVersion/julia-$1-linux-x86_64.tar.gz" -o "julia-$1-linux-x86_64.tar.gz" - mkdir -p "$juliaInstallationPath" - tar -C "$juliaInstallationPath" -xzf "julia-$1-linux-x86_64.tar.gz" --strip-components=1 - rm "julia-$1-linux-x86_64.tar.gz" - - # If this version of Julia is to be the default version, - # symlink it into the path - if [ "$2" = true ]; then - ln -s "$juliaInstallationPath/bin/julia" /usr/bin/julia - fi - - # Run tests to determine that the software installed as expected - echo "Testing to make sure that script performed as expected, and basic scenarios work" - - # If this version of Julia is to be the default version, - # check that it has been added to PATH - if [ "$2" = true ]; then - if ! command -v julia; then - echo "Julia was not installed or found on PATH" - exit 1 - fi - fi - - # Verify output of julia --version - if [ ! "$($juliaInstallationPath/bin/julia --version)" = "julia version $1" ]; then - echo "Julia was not installed correctly" - exit 1 - fi -} - -InstallJulia "$(GetLatestJuliaRelease)" true +invoke_tests "Tools" "Julia" diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh deleted file mode 100644 index 419f4e60f..000000000 --- a/images/linux/scripts/installers/kind.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e -################################################################################ -## File: kind.sh -## Desc: Installs kind -################################################################################ - -# Install KIND -URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))') -curl -L -o /usr/local/bin/kind $URL -chmod +x /usr/local/bin/kind - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v kind; then - echo "Kind was not installed or found on PATH" - exit 1 -fi diff --git a/images/linux/scripts/installers/kubernetes-tools.sh b/images/linux/scripts/installers/kubernetes-tools.sh index e74515ea2..685e25fba 100644 --- a/images/linux/scripts/installers/kubernetes-tools.sh +++ b/images/linux/scripts/installers/kubernetes-tools.sh @@ -4,6 +4,13 @@ ## Desc: Installs kubectl, helm, kustomize ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + +# Install KIND +URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))') +curl -L -o /usr/local/bin/kind $URL +chmod +x /usr/local/bin/kind + ## Install kubectl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - touch /etc/apt/sources.list.d/kubernetes.list @@ -25,27 +32,4 @@ download_url="https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master curl -s "$download_url" | bash mv kustomize /usr/local/bin -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v kubectl; then - echo "kubectl was not installed" - exit 1 -fi - -if ! command -v helm; then - echo "helm was not installed" - exit 1 -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that minikube was installed" -if ! command -v minikube; then - echo "minikube was not installed" - exit 1 -fi - -echo "Testing to make sure that kustomize was installed" -if ! command -v kustomize; then - echo "kustomize was not installed" - exit 1 -fi +invoke_tests "Tools" "Kubernetes tools" diff --git a/images/linux/scripts/installers/leiningen.sh b/images/linux/scripts/installers/leiningen.sh index 059dfdb56..7919513fe 100644 --- a/images/linux/scripts/installers/leiningen.sh +++ b/images/linux/scripts/installers/leiningen.sh @@ -4,6 +4,8 @@ ## Desc: Installs Leiningen ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + LEIN_BIN=/usr/local/bin/lein curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN chmod 0755 $LEIN_BIN @@ -16,11 +18,4 @@ LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar") echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v lein; then - echo "lein was not installed" - exit 1 -else - lein new app testapp && rm -rf testapp -fi +invoke_tests "Tools" "Leiningen" \ No newline at end of file diff --git a/images/linux/scripts/installers/mercurial.sh b/images/linux/scripts/installers/mercurial.sh index 4c3493d8c..b04ffa92e 100644 --- a/images/linux/scripts/installers/mercurial.sh +++ b/images/linux/scripts/installers/mercurial.sh @@ -4,6 +4,8 @@ ## Desc: Installs Mercurial ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Source the helpers for use with the script source $HELPER_SCRIPTS/os.sh @@ -16,8 +18,4 @@ fi apt-get install -y --no-install-recommends mercurial -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v hg; then - exit 1 -fi +invoke_tests "Tools" "Mercurial" \ No newline at end of file diff --git a/images/linux/scripts/installers/miniconda.sh b/images/linux/scripts/installers/miniconda.sh index 3dae1e1bb..95d1ef9e3 100644 --- a/images/linux/scripts/installers/miniconda.sh +++ b/images/linux/scripts/installers/miniconda.sh @@ -4,6 +4,8 @@ ## Desc: Installs miniconda ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install Miniconda curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ && chmod +x miniconda.sh \ @@ -14,3 +16,5 @@ CONDA=/usr/share/miniconda echo "CONDA=$CONDA" | tee -a /etc/environment ln -s $CONDA/bin/conda /usr/bin/conda + +invoke_tests "Tools" "Conda" \ No newline at end of file diff --git a/images/linux/scripts/installers/netlify.sh b/images/linux/scripts/installers/netlify.sh index 42121ab7e..8f0de592b 100644 --- a/images/linux/scripts/installers/netlify.sh +++ b/images/linux/scripts/installers/netlify.sh @@ -4,12 +4,9 @@ ## Desc: Installs the Netlify CLI ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install the Netlify CLI npm i -g netlify-cli -# Validate the installation -echo "Validate the installation" -if ! command -v netlify; then - echo "Netlify CLI was not installed" - exit 1 -fi +invoke_tests "Tools" "Netlify" \ No newline at end of file diff --git a/images/linux/scripts/installers/packer.sh b/images/linux/scripts/installers/packer.sh index b45a87ac9..5fe11688c 100644 --- a/images/linux/scripts/installers/packer.sh +++ b/images/linux/scripts/installers/packer.sh @@ -4,15 +4,12 @@ ## Desc: Installs packer ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install Packer PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version) curl -LO "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip" unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d /usr/local/bin rm -f "packer_${PACKER_VERSION}_linux_amd64.zip" -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v packer; then - echo "Packer was not installed or found on PATH" - exit 1 -fi +invoke_tests "Tools" "Packer" \ No newline at end of file diff --git a/images/linux/scripts/installers/phantomjs.sh b/images/linux/scripts/installers/phantomjs.sh index a774b2d0a..2207f6379 100644 --- a/images/linux/scripts/installers/phantomjs.sh +++ b/images/linux/scripts/installers/phantomjs.sh @@ -4,6 +4,8 @@ ## Desc: Installs PhantomJS ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install PhantomJS apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 @@ -12,9 +14,4 @@ tar xvjf $PHANTOM_JS.tar.bz2 mv $PHANTOM_JS /usr/local/share ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v phantomjs; then - echo "phantomjs was not installed" - exit 1 -fi +invoke_tests "Tools" "Phantomjs" diff --git a/images/linux/scripts/installers/pollinate.sh b/images/linux/scripts/installers/pollinate.sh index fe2350d94..96fb893b0 100644 --- a/images/linux/scripts/installers/pollinate.sh +++ b/images/linux/scripts/installers/pollinate.sh @@ -4,12 +4,9 @@ ## Desc: Installs Pollinate ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install Pollinate apt-get install -y --no-install-recommends pollinate -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v pollinate; then - echo "pollinate was not installed" - exit 1 -fi +invoke_tests "Tools" "Pollinate" diff --git a/images/linux/scripts/installers/pulumi.sh b/images/linux/scripts/installers/pulumi.sh index 444a3e7f3..4c6934c31 100644 --- a/images/linux/scripts/installers/pulumi.sh +++ b/images/linux/scripts/installers/pulumi.sh @@ -6,6 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/install.sh +source $HELPER_SCRIPTS/invoke-tests.sh # Install Pulumi VERSION=$(curl --fail --silent -L "https://www.pulumi.com/latest-version") @@ -13,9 +14,4 @@ TARBALL_URL="https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-linux-x64.ta download_with_retries ${TARBALL_URL} "/tmp" pulumi-v${VERSION}.tar.gz tar --strip=1 -xvf /tmp/pulumi-v${VERSION}.tar.gz -C /usr/local/bin -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v pulumi ; then - echo "Pulumi was not installed" - exit 1 -fi +invoke_tests "Tools" "Pulumi" diff --git a/images/linux/scripts/installers/rndgenerator.sh b/images/linux/scripts/installers/rndgenerator.sh index 98f1dbaa1..ecc8626c5 100644 --- a/images/linux/scripts/installers/rndgenerator.sh +++ b/images/linux/scripts/installers/rndgenerator.sh @@ -4,14 +4,9 @@ ## Desc: Install random number generator ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install haveged apt-get -y install haveged -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in haveged; do - if ! command -v $cmd; then - echo "$cmd was not installed or not found on PATH" - exit 1 - fi -done +invoke_tests "Tools" "Haveged" \ No newline at end of file diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index 0f0963587..5ed2f75bf 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -119,3 +119,121 @@ Describe "gfortran" { "$GfortranVersion --version" | Should -ReturnZeroExitCode } } + +Describe "Git" { + It "git" { + "git --version" | Should -ReturnZeroExitCode + } + + It "git-lfs" { + "git-lfs --version" | Should -ReturnZeroExitCode + } + + It "git-ftp" { + "git-ftp --version" | Should -ReturnZeroExitCode + } + + It "hub-cli" { + "hub --version" | Should -ReturnZeroExitCode + } +} + +Describe "Heroku" { + It "heroku" { + "heroku --version" | Should -ReturnZeroExitCode + } +} + +Describe "HHVM" { + It "hhvm" { + "hhvm --version" | Should -ReturnZeroExitCode + } +} + +Describe "Homebrew" { + It "homebrew" { + "brew --version" | Should -ReturnZeroExitCode + } +} + +Describe "Julia" { + It "julia" { + "julia --version" | Should -ReturnZeroExitCode + } +} + +Describe "Kubernetes tools" { + It "kind" { + "kind --version" | Should -ReturnZeroExitCode + } + + It "kubectl" { + "kubectl version" | Should -MatchCommandOutput "Client Version: version.Info" + } + + It "helm" { + "helm version" | Should -ReturnZeroExitCode + } + + It "minikube" { + "minikube version" | Should -ReturnZeroExitCode + } + + It "kustomize" { + "kustomize version" | Should -ReturnZeroExitCode + } +} + +Describe "Leiningen" { + It "leiningen" { + "lein --version" | Should -ReturnZeroExitCode + } +} + +Describe "Mercurial" { + It "mercurial" { + "hg --version" | Should -ReturnZeroExitCode + } +} + +Describe "Conda" { + It "conda" { + "conda --version" | Should -ReturnZeroExitCode + } +} + +Describe "Netlify" { + It "netlify" { + "netlify --version" | Should -ReturnZeroExitCode + } +} + +Describe "Packer" { + It "packer" { + "packer --version" | Should -ReturnZeroExitCode + } +} + +Describe "Pollinate" { + It "pollinate" { + "sudo pollinate -r && sleep 5 && sudo grep pollinate /var/log/syslog" | Should -ReturnZeroExitCode + } +} + +Describe "Pulumi" { + It "pulumi" { + "pulumi version" | Should -ReturnZeroExitCode + } +} + +Describe "Phantomjs" { + It "phantomjs" { + "phantomjs --version" | Should -ReturnZeroExitCode + } +} + +Describe "Haveged" { + It "haveged" { + "systemctl status haveged | grep 'active (running)'" | Should -ReturnZeroExitCode + } +} diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 2801570dc..e30f30105 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -198,7 +198,6 @@ "{{template_dir}}/scripts/installers/hhvm.sh", "{{template_dir}}/scripts/installers/image-magick.sh", "{{template_dir}}/scripts/installers/java-tools.sh", - "{{template_dir}}/scripts/installers/kind.sh", "{{template_dir}}/scripts/installers/kubernetes-tools.sh", "{{template_dir}}/scripts/installers/oc.sh", "{{template_dir}}/scripts/installers/leiningen.sh", @@ -273,7 +272,8 @@ ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" + "DEBIAN_FRONTEND=noninteractive", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, @@ -287,16 +287,8 @@ }, { "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", + "pause_before": "60s", + "start_retry_timeout": "10m", "scripts": [ "{{template_dir}}/scripts/installers/cleanup.sh" ], diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index fcab659ac..f1ffce716 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -201,7 +201,6 @@ "{{template_dir}}/scripts/installers/hhvm.sh", "{{template_dir}}/scripts/installers/image-magick.sh", "{{template_dir}}/scripts/installers/java-tools.sh", - "{{template_dir}}/scripts/installers/kind.sh", "{{template_dir}}/scripts/installers/kubernetes-tools.sh", "{{template_dir}}/scripts/installers/oc.sh", "{{template_dir}}/scripts/installers/leiningen.sh", @@ -277,7 +276,8 @@ ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" + "DEBIAN_FRONTEND=noninteractive", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, @@ -291,16 +291,8 @@ }, { "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", + "pause_before": "60s", + "start_retry_timeout": "10m", "scripts": [ "{{template_dir}}/scripts/installers/cleanup.sh" ], diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 9613330e8..a273d884f 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -201,7 +201,6 @@ "{{template_dir}}/scripts/installers/hhvm.sh", "{{template_dir}}/scripts/installers/image-magick.sh", "{{template_dir}}/scripts/installers/java-tools.sh", - "{{template_dir}}/scripts/installers/kind.sh", "{{template_dir}}/scripts/installers/kubernetes-tools.sh", "{{template_dir}}/scripts/installers/oc.sh", "{{template_dir}}/scripts/installers/leiningen.sh", @@ -277,7 +276,8 @@ ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" + "DEBIAN_FRONTEND=noninteractive", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, @@ -291,16 +291,8 @@ }, { "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", + "pause_before": "60s", + "start_retry_timeout": "10m", "scripts": [ "{{template_dir}}/scripts/installers/cleanup.sh" ],