Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
- Moved node, ruby, and python test cases into "misc tools" test
- Re-enabled terminus test
- Cleaned up Dockerfiles from legacy code
  • Loading branch information
lmakarov committed Nov 24, 2023
1 parent a9ce72f commit 49946f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 230 deletions.
82 changes: 2 additions & 80 deletions 8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ RUN set -xe; \
imagick \
memcached \
redis \
ssh2-beta \
ssh2 \
xdebug \
xhprof \
;\
Expand All @@ -211,7 +211,7 @@ RUN set -xe; \
# Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \
# TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos).
#curl -fsSL https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql.list; \
#curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \
\
buildDeps=" \
Expand Down Expand Up @@ -340,52 +340,6 @@ RUN set -e; \
export YARN_PROFILE="$HOME/.profile"; \
curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null

## Ruby (installed as user) via rvm
## Note: Disabled. rvm + its build dependecies bloat the image (~80MB)
## Debian 11 ships with Ruby 2.7, so we'll stick with that by default.
## It is still possible for the end user to switch to a different Ruby version via rvm.
#ENV \
# RVM_VERSION_INSTALL=1.29.10 \
# RUBY_VERSION_INSTALL=2.7.2
## Don't use -x here, as the output may be excessive
#RUN set -e; \
# # Export ruby gem bin path
# echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \
# . $HOME/.profile; \
# # Public GPG servers are not realiable, so downloading keys from rvm.io instead.
# #gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
# # Import and trust rvm keys
# # [email protected]
# curl -sSL https://rvm.io/mpapis.asc | gpg --batch --import -; \
# echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | gpg --batch --import-ownertrust; \
# # [email protected]
# curl -sSL https://rvm.io/pkuczynski.asc | gpg --batch --import -; \
# echo 7D2BAF1CF37B13E2069D6956105BD0E739499BDB:6: | gpg --batch --import-ownertrust; \
# \
# echo 'rvm_autoupdate_flag=0' >> $HOME/.rvmrc; \
# echo 'rvm_silence_path_mismatch_check_flag=1' >> $HOME/.rvmrc; \
# curl -fsSL https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION_INSTALL}/binscripts/rvm-installer | bash -s -- --ignore-dotfiles --version ${RVM_VERSION_INSTALL}; \
# { \
# echo ''; \
# echo 'export PATH="$PATH:$HOME/.rvm/bin"'; \
# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'; \
# } >> $HOME/.profile; \
# # Reload $HOME/.profile to apply settings for the current shell
# . $HOME/.profile; \
# \
# # rvm.io does not currently have ruby binaries for Debian 9, so Ruby is compiled from source, which requires a bunch
# # of extra dependencies installed (rvm installs these automatically), which bloat this image:
# # rvm/ruby required packages: gawk, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev
# rvm install ruby-${RUBY_VERSION_INSTALL}; \
# rvm use ruby-${RUBY_VERSION_INSTALL} --default; \
# \
# gem install --user-install bundler; \
# # Have bundler install gems locally (./.bundle) by default
# echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile; \
# \
# rvm cleanup all; \
# rvm gemset globalcache enable

## Ruby bundler
## Don't use -x here, as the output may be excessive
RUN set -e; \
Expand All @@ -396,38 +350,6 @@ RUN set -e; \
# Have bundler install gems in the current directory (./.bundle) by default
echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile

# Python (installed as user) via pyenv
# Note: Disabled. pyenv + its build dependecies bloat the image (~300MB).
# Debian 10 ships with Python 3.7, so we'll stick with that by default.
# It is still possible for the end user to switch to a different python version via pyenv.
#ENV \
# PYENV_VERSION_INSTALL=1.2.21 \
# PYTHON_VERSION_INSTALL=3.8.3
#RUN set -xe; \
# # pyenv requires a bunch of build dependencies installed, which would bloat this image
# # See https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
# sudo apt-get update >/dev/null; \
# sudo apt-get -y --no-install-recommends install >/dev/null \
# build-essential libssl-dev zlib1g-dev libbz2-dev \
# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
# ;\
# # Cleanup
# sudo apt-get clean; sudo rm -rf /var/lib/apt/lists/*; \
# \
# git clone --depth 1 -b v${PYENV_VERSION_INSTALL} https://github.com/pyenv/pyenv.git $HOME/.pyenv; \
# rm -rf $HOME/.pyenv/.git; \
# { \
# echo ''; \
# echo 'export PYENV_ROOT="$HOME/.pyenv"'; \
# echo 'export PATH="$PYENV_ROOT/bin:$PATH"'; \
# echo 'eval "$(pyenv init -)"'; \
# } >> $HOME/.profile; \
# # Reload $HOME/.profile to apply settings for the current shell
# . $HOME/.profile; \
# pyenv install ${PYTHON_VERSION_INSTALL}; \
# pyenv global ${PYTHON_VERSION_INSTALL}

# Notify web container about started fin exec
RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile

Expand Down
82 changes: 2 additions & 80 deletions 8.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ RUN set -xe; \
imagick \
memcached \
redis \
ssh2-beta \
ssh2 \
xdebug \
xhprof \
;\
Expand All @@ -211,7 +211,7 @@ RUN set -xe; \
# Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \
# TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos).
#curl -fsSL https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql.list; \
#curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \
\
buildDeps=" \
Expand Down Expand Up @@ -340,52 +340,6 @@ RUN set -e; \
export YARN_PROFILE="$HOME/.profile"; \
curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null

## Ruby (installed as user) via rvm
## Note: Disabled. rvm + its build dependecies bloat the image (~80MB)
## Debian 11 ships with Ruby 2.7, so we'll stick with that by default.
## It is still possible for the end user to switch to a different Ruby version via rvm.
#ENV \
# RVM_VERSION_INSTALL=1.29.10 \
# RUBY_VERSION_INSTALL=2.7.2
## Don't use -x here, as the output may be excessive
#RUN set -e; \
# # Export ruby gem bin path
# echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \
# . $HOME/.profile; \
# # Public GPG servers are not realiable, so downloading keys from rvm.io instead.
# #gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
# # Import and trust rvm keys
# # [email protected]
# curl -sSL https://rvm.io/mpapis.asc | gpg --batch --import -; \
# echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | gpg --batch --import-ownertrust; \
# # [email protected]
# curl -sSL https://rvm.io/pkuczynski.asc | gpg --batch --import -; \
# echo 7D2BAF1CF37B13E2069D6956105BD0E739499BDB:6: | gpg --batch --import-ownertrust; \
# \
# echo 'rvm_autoupdate_flag=0' >> $HOME/.rvmrc; \
# echo 'rvm_silence_path_mismatch_check_flag=1' >> $HOME/.rvmrc; \
# curl -fsSL https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION_INSTALL}/binscripts/rvm-installer | bash -s -- --ignore-dotfiles --version ${RVM_VERSION_INSTALL}; \
# { \
# echo ''; \
# echo 'export PATH="$PATH:$HOME/.rvm/bin"'; \
# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'; \
# } >> $HOME/.profile; \
# # Reload $HOME/.profile to apply settings for the current shell
# . $HOME/.profile; \
# \
# # rvm.io does not currently have ruby binaries for Debian 9, so Ruby is compiled from source, which requires a bunch
# # of extra dependencies installed (rvm installs these automatically), which bloat this image:
# # rvm/ruby required packages: gawk, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev
# rvm install ruby-${RUBY_VERSION_INSTALL}; \
# rvm use ruby-${RUBY_VERSION_INSTALL} --default; \
# \
# gem install --user-install bundler; \
# # Have bundler install gems locally (./.bundle) by default
# echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile; \
# \
# rvm cleanup all; \
# rvm gemset globalcache enable

## Ruby bundler
## Don't use -x here, as the output may be excessive
RUN set -e; \
Expand All @@ -396,38 +350,6 @@ RUN set -e; \
# Have bundler install gems in the current directory (./.bundle) by default
echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile

# Python (installed as user) via pyenv
# Note: Disabled. pyenv + its build dependecies bloat the image (~300MB).
# Debian 10 ships with Python 3.7, so we'll stick with that by default.
# It is still possible for the end user to switch to a different python version via pyenv.
#ENV \
# PYENV_VERSION_INSTALL=1.2.21 \
# PYTHON_VERSION_INSTALL=3.8.3
#RUN set -xe; \
# # pyenv requires a bunch of build dependencies installed, which would bloat this image
# # See https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
# sudo apt-get update >/dev/null; \
# sudo apt-get -y --no-install-recommends install >/dev/null \
# build-essential libssl-dev zlib1g-dev libbz2-dev \
# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
# ;\
# # Cleanup
# sudo apt-get clean; sudo rm -rf /var/lib/apt/lists/*; \
# \
# git clone --depth 1 -b v${PYENV_VERSION_INSTALL} https://github.com/pyenv/pyenv.git $HOME/.pyenv; \
# rm -rf $HOME/.pyenv/.git; \
# { \
# echo ''; \
# echo 'export PYENV_ROOT="$HOME/.pyenv"'; \
# echo 'export PATH="$PYENV_ROOT/bin:$PATH"'; \
# echo 'eval "$(pyenv init -)"'; \
# } >> $HOME/.profile; \
# # Reload $HOME/.profile to apply settings for the current shell
# . $HOME/.profile; \
# pyenv install ${PYTHON_VERSION_INSTALL}; \
# pyenv global ${PYTHON_VERSION_INSTALL}

# Notify web container about started fin exec
RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile

Expand Down
78 changes: 8 additions & 70 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,9 @@ _healthcheck_wait ()
unset output

# Check Terminus version
# Terminus v3 is not yet fully compatible with PHP 8.1
# TODO: Re-enable tests for Terminus v3 on PHP 8.1 once stable.
# See: https://github.com/pantheon-systems/terminus/issues/2256
if [[ "${VERSION}" != "8.1" ]]; then
run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"'
[[ ${status} == 0 ]]
unset output
fi
run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"'
[[ ${status} == 0 ]]
unset output

# Check Platform CLI version
run docker exec -u docker "$NAME" bash -lc 'set -x; platform --version | grep "Platform.sh CLI ${PLATFORMSH_CLI_VERSION}"'
Expand All @@ -240,7 +235,7 @@ _healthcheck_wait ()
make clean
}

@test "Check NodeJS tools and versions" {
@test "Check misc tools and versions" {
[[ $SKIP == 1 ]] && skip

### Setup ###
Expand All @@ -266,73 +261,16 @@ _healthcheck_wait ()
[[ ${status} == 0 ]]
unset output

### Cleanup ###
make clean
}

@test "Check Ruby tools and versions" {
[[ $SKIP == 1 ]] && skip

### Setup ###
make start

run _healthcheck_wait
unset output

### Tests ###

# rvm
run docker exec -u docker "$NAME" bash -lc 'rvm --version 2>&1 | grep "${RVM_VERSION_INSTALL}"'
[[ ${status} == 0 ]]
unset output

# ruby
#run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "${RUBY_VERSION_INSTALL}"'
# Default Ruby version in Debian 11 = 2.7.x
run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "ruby 2.7"'
[[ ${status} == 0 ]]
unset output

### Cleanup ###
make clean
}

@test "Check Python tools and versions" {
[[ $SKIP == 1 ]] && skip

### Setup ###
make start

run _healthcheck_wait
unset output

### Tests ###

# pyenv
run docker exec -u docker "$NAME" bash -lc 'pyenv --version 2>&1 | grep "${PYENV_VERSION_INSTALL}"'
# Stock Ruby version in Debian 12 is 3.1.x
run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "ruby 3.1"'
[[ ${status} == 0 ]]
unset output

# pyenv
run docker exec -u docker "$NAME" bash -lc 'python --version 2>&1 | grep "${PYTHON_VERSION_INSTALL}"'
# Stock Python version in Debian 12 is 3.11.x
run docker exec -u docker "$NAME" bash -lc 'python3 --version 2>&1 | grep "Python 3.11"'
[[ ${status} == 0 ]]
unset output

### Cleanup ###
make clean
}

@test "Check misc tools and versions" {
[[ $SKIP == 1 ]] && skip

### Setup ###
make start

run _healthcheck_wait
unset output

### Tests ###

# Check msmtp
run docker exec -u docker "$NAME" which msmtp
echo "$output" | grep "/usr/bin/msmtp"
Expand Down

0 comments on commit 49946f7

Please sign in to comment.