[Ubuntu] Migrate missing tools tests to Pester (#2374)

* add missing tests

* fix naming and nvm test

* fix containers test and bring pwsh test back

* remove pwsh test

* small fix
This commit is contained in:
Dibir Magomedsaygitov
2020-12-31 10:00:43 +03:00
committed by GitHub
parent 3753e7b923
commit 875891b86b
40 changed files with 51 additions and 80 deletions
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs 7-zip ## Desc: Installs 7-zip
################################################################################ ################################################################################
# Install 7-Zip # Install 7-Zip
apt-get update -y apt-get update -y
apt-get install -y p7zip p7zip-full p7zip-rar apt-get install -y p7zip p7zip-full p7zip-rar
@@ -4,7 +4,6 @@
## Desc: Installs Alibaba Cloud CLI ## Desc: Installs Alibaba Cloud CLI
################################################################################ ################################################################################
# Install Alibaba Cloud CLI # Install Alibaba Cloud CLI
URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))') URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))')
wget -P /tmp $URL wget -P /tmp $URL
@@ -5,7 +5,6 @@
## Requires Python >=3.6, must be run as non-root user after toolset installation ## Requires Python >=3.6, must be run as non-root user after toolset installation
################################################################################ ################################################################################
# Download latest aws sam cli sources # Download latest aws sam cli sources
TarballUrl=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r '.tarball_url') TarballUrl=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r '.tarball_url')
TarballPath="/tmp/aws-sam-cli.tar.gz" TarballPath="/tmp/aws-sam-cli.tar.gz"
@@ -4,7 +4,6 @@
## Desc: Installs AzCopy ## Desc: Installs AzCopy
################################################################################ ################################################################################
# Install AzCopy7 # Install AzCopy7
wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64
tar -xf azcopy.tar.gz tar -xf azcopy.tar.gz
@@ -4,7 +4,6 @@
## Desc: Installed Azure CLI (az) ## Desc: Installed Azure CLI (az)
################################################################################ ################################################################################
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
@@ -4,7 +4,6 @@
## Desc: Installed Azure DevOps CLI (az devops) ## Desc: Installed Azure DevOps CLI (az devops)
################################################################################ ################################################################################
# AZURE_EXTENSION_DIR shell variable defines where modules are installed # AZURE_EXTENSION_DIR shell variable defines where modules are installed
# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview # https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
export AZURE_EXTENSION_DIR=/opt/az/azcliextensions export AZURE_EXTENSION_DIR=/opt/az/azcliextensions
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel) ## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel)
################################################################################ ################################################################################
# Install bazel # Install bazel
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs CMake ## Desc: Installs CMake
################################################################################ ################################################################################
# Test to see if the software in question is already installed, if not install it # 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" echo "Checking to see if the installer script has already been run"
if command -v cmake; then if command -v cmake; then
@@ -4,6 +4,8 @@
## Desc: Installs container tools: podman, buildah and skopeo onto the image ## Desc: Installs container tools: podman, buildah and skopeo onto the image
################################################################################ ################################################################################
source $HELPER_SCRIPTS/os.sh
# Install podman, buildah, scopeo container's tools # Install podman, buildah, scopeo container's tools
install_packages=(podman buildah skopeo) install_packages=(podman buildah skopeo)
source /etc/os-release source /etc/os-release
@@ -15,11 +17,6 @@ apt-get -qq -y install ${install_packages[@]}
mkdir -p /etc/containers mkdir -p /etc/containers
echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf
# Check that tools are installed properly if isUbuntu18 || isUbuntu20 ; then
echo "Testing to make sure that script performed as expected, and basic scenarios work" invoke_tests "Tools" "Containers"
for cmd in ${install_packages[@]}; do fi
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
@@ -4,7 +4,6 @@
## Desc: Installs Docker Compose ## Desc: Installs Docker Compose
################################################################################ ################################################################################
# Install latest docker-compose from releases # Install latest docker-compose from releases
URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1) URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1)
curl -L $URL -o /usr/local/bin/docker-compose curl -L $URL -o /usr/local/bin/docker-compose
@@ -4,7 +4,6 @@
## Desc: Installs erlang ## Desc: Installs erlang
################################################################################ ################################################################################
source_list=/etc/apt/sources.list.d/eslerlang.list source_list=/etc/apt/sources.list.d/eslerlang.list
# Install Erlang # Install Erlang
@@ -5,7 +5,6 @@
## Must be run as non-root user after homebrew ## Must be run as non-root user after homebrew
################################################################################ ################################################################################
# Install GitHub CLI # Install GitHub CLI
url=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.assets[].browser_download_url|select(contains("linux") and contains("amd64") and contains(".deb"))') url=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.assets[].browser_download_url|select(contains("linux") and contains("amd64") and contains(".deb"))')
wget $url wget $url
@@ -4,7 +4,6 @@
## Desc: Installs google-chrome and chromedriver ## Desc: Installs google-chrome and chromedriver
################################################################################ ################################################################################
LSB_RELEASE=$(lsb_release -rs) LSB_RELEASE=$(lsb_release -rs)
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
@@ -4,7 +4,6 @@
## Desc: Installs the Google Cloud SDK ## Desc: Installs the Google Cloud SDK
################################################################################ ################################################################################
# Install the Google Cloud SDK # Install the Google Cloud SDK
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
@@ -4,7 +4,6 @@
## Desc: Installs Heroku CLI ## Desc: Installs Heroku CLI
################################################################################ ################################################################################
# Install Heroku CLI # Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs hhvm ## Desc: Installs hhvm
################################################################################ ################################################################################
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
add-apt-repository https://dl.hhvm.com/ubuntu add-apt-repository https://dl.hhvm.com/ubuntu
apt-get update apt-get update
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs Julia, and adds Julia to the path ## Desc: Installs Julia, and adds Julia to the path
################################################################################ ################################################################################
# This function fetches the latest Julia release from the GitHub API # This function fetches the latest Julia release from the GitHub API
# Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c # Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function GetLatestJuliaRelease () { function GetLatestJuliaRelease () {
@@ -4,7 +4,6 @@
## Desc: Installs kubectl, helm, kustomize ## Desc: Installs kubectl, helm, kustomize
################################################################################ ################################################################################
# Install 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"))') 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 curl -L -o /usr/local/bin/kind $URL
@@ -4,7 +4,6 @@
## Desc: Installs Leiningen ## Desc: Installs Leiningen
################################################################################ ################################################################################
LEIN_BIN=/usr/local/bin/lein LEIN_BIN=/usr/local/bin/lein
curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN
chmod 0755 $LEIN_BIN chmod 0755 $LEIN_BIN
@@ -4,7 +4,6 @@
## Desc: Installs Mercurial ## Desc: Installs Mercurial
################################################################################ ################################################################################
# Source the helpers for use with the script # Source the helpers for use with the script
source $HELPER_SCRIPTS/os.sh source $HELPER_SCRIPTS/os.sh
@@ -4,7 +4,6 @@
## Desc: Installs miniconda ## Desc: Installs miniconda
################################################################################ ################################################################################
# Install Miniconda # Install Miniconda
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \
&& chmod +x miniconda.sh \ && chmod +x miniconda.sh \
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs Mono ## Desc: Installs Mono
################################################################################ ################################################################################
LSB_CODENAME=$(lsb_release -cs) LSB_CODENAME=$(lsb_release -cs)
# Test to see if the software in question is already installed, if not install it # Test to see if the software in question is already installed, if not install it
@@ -4,7 +4,6 @@
## Desc: Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017) ## Desc: Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017)
################################################################################ ################################################################################
export ACCEPT_EULA=Y export ACCEPT_EULA=Y
apt-get update apt-get update
@@ -4,7 +4,6 @@
## Desc: Installs the Netlify CLI ## Desc: Installs the Netlify CLI
################################################################################ ################################################################################
# Install the Netlify CLI # Install the Netlify CLI
npm i -g netlify-cli npm i -g netlify-cli
+1 -8
View File
@@ -20,11 +20,4 @@ apt-get update
# Install yarn # Install yarn
apt-get install -y --no-install-recommends yarn apt-get install -y --no-install-recommends yarn
# Run tests to determine that the software installed as expected invoke_tests "Tools" "Node.js"
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in node grunt gulp webpack parcel yarn newman; do
if ! command -v $cmd; then
echo "$cmd was not installed"
exit 1
fi
done
+1 -4
View File
@@ -12,10 +12,7 @@ echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
if ! command -v nvm; then invoke_tests "Tools" "nvm"
echo "nvm was not installed"
exit 1
fi
# set system node.js as default one # set system node.js as default one
nvm alias default system nvm alias default system
@@ -4,7 +4,6 @@
## Desc: Installs packer ## Desc: Installs packer
################################################################################ ################################################################################
# Install Packer # Install Packer
PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version) 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" curl -LO "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
@@ -4,7 +4,6 @@
## Desc: Installs PhantomJS ## Desc: Installs PhantomJS
################################################################################ ################################################################################
# Install PhantomJS # Install PhantomJS
apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 PHANTOM_JS=phantomjs-2.1.1-linux-x86_64
@@ -4,7 +4,6 @@
## Desc: Install tools via pipx ## Desc: Install tools via pipx
################################################################################ ################################################################################
export PATH="$PATH:/opt/pipx_bin" export PATH="$PATH:/opt/pipx_bin"
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
@@ -4,7 +4,6 @@
## Desc: Installs Pollinate ## Desc: Installs Pollinate
################################################################################ ################################################################################
# Install Pollinate # Install Pollinate
apt-get install -y --no-install-recommends pollinate apt-get install -y --no-install-recommends pollinate
@@ -6,10 +6,3 @@
# Install Powershell # Install Powershell
apt-get install -y powershell apt-get install -y powershell
# 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 pwsh; then
echo "pwsh was not installed"
exit 1
fi
+1 -8
View File
@@ -40,11 +40,4 @@ if isUbuntu18 || isUbuntu20 ; then
fi fi
fi fi
# Run tests to determine that the software installed as expected invoke_tests "Tools" "Python"
echo "Testing to make sure that script performed as expected, and basic scenarios work"
for cmd in python pip python3 pip3; do
if ! command -v $cmd; then
echo "$cmd was not installed or not found on PATH"
exit 1
fi
done
@@ -4,7 +4,6 @@
## Desc: Install random number generator ## Desc: Install random number generator
################################################################################ ################################################################################
# Install haveged # Install haveged
apt-get -y install haveged apt-get -y install haveged
-1
View File
@@ -4,7 +4,6 @@
## Desc: Installs sbt ## Desc: Installs sbt
################################################################################ ################################################################################
# Install sbt # Install sbt
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html # https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
@@ -4,7 +4,6 @@
## Desc: Installs selenium server ## Desc: Installs selenium server
################################################################################ ################################################################################
# Determine latest selenium standalone server version # Determine latest selenium standalone server version
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2) SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2)
@@ -4,7 +4,6 @@
## Desc: Installs Subversion client ## Desc: Installs Subversion client
################################################################################ ################################################################################
# Install Subversion # Install Subversion
apt-get install -y --no-install-recommends subversion apt-get install -y --no-install-recommends subversion
-1
View File
@@ -1,6 +1,5 @@
#!/bin/bash -e #!/bin/bash -e
# Install Swig # Install Swig
sudo apt-get install -y swig sudo apt-get install -y swig
@@ -4,7 +4,6 @@
## Desc: Installs terraform ## Desc: Installs terraform
################################################################################ ################################################################################
# Install Terraform # Install Terraform
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
@@ -4,7 +4,6 @@
## Desc: Installs the Vercel CLI ## Desc: Installs the Vercel CLI
################################################################################ ################################################################################
# Install the Vercel CLI # Install the Vercel CLI
npm i -g vercel npm i -g vercel
+42 -10
View File
@@ -83,16 +83,6 @@ Describe "Docker-compose" {
} }
} }
Describe "PowerShell Core" {
It "pwsh" {
"pwsh --version" | Should -ReturnZeroExitCode
}
It "Execute 2+2 command" {
pwsh -Command "2+2" | Should -BeExactly 4
}
}
Describe "Ansible" { Describe "Ansible" {
It "Ansible" { It "Ansible" {
"ansible --version" | Should -ReturnZeroExitCode "ansible --version" | Should -ReturnZeroExitCode
@@ -344,3 +334,45 @@ Describe "Haveged" {
"systemctl status haveged | grep 'active (running)'" | Should -ReturnZeroExitCode "systemctl status haveged | grep 'active (running)'" | Should -ReturnZeroExitCode
} }
} }
Describe "Containers" -Skip:(Test-IsUbuntu16) {
$testCases = @("podman", "buildah", "skopeo") | ForEach-Object { @{ContainerCommand = $_} }
It "<ContainerCommand>" -TestCases $testCases {
param (
[string] $ContainerCommand
)
"$ContainerCommand -v" | Should -ReturnZeroExitCode
}
}
Describe "Node.js" {
$testCases = @("node", "grunt", "gulp", "webpack", "parcel", "yarn", "newman") | ForEach-Object { @{NodeCommand = $_} }
It "<NodeCommand>" -TestCases $testCases {
param (
[string] $NodeCommand
)
"$NodeCommand --version" | Should -ReturnZeroExitCode
}
}
Describe "nvm" {
It "nvm" {
"source /etc/skel/.nvm/nvm.sh && nvm --version" | Should -ReturnZeroExitCode
}
}
Describe "Python" {
$testCases = @("python", "pip", "python3", "pip3") | ForEach-Object { @{PythonCommand = $_} }
It "<PythonCommand>" -TestCases $testCases {
param (
[string] $PythonCommand
)
"$PythonCommand --version" | Should -ReturnZeroExitCode
}
}