Skip to content

Commit

Permalink
Merge pull request #621 from srvrco/bash4
Browse files Browse the repository at this point in the history
Add tests for bash 4.0, 4.2, 5.0
  • Loading branch information
timkimber authored Dec 31, 2020
2 parents 52d1fe5 + 1b24a58 commit e943c05
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 17 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/run-tests-pebble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@ jobs:
run: docker-compose up -d --build
- name: Run test suite on Alpine
run: test/run-test.sh alpine
test-bash-4-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the docker-compose stack
run: docker-compose up -d --build
- name: Run test suite on Alpine using Bash 4.0
run: test/run-test.sh bash4-0
test-bash-4-2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the docker-compose stack
run: docker-compose up -d --build
- name: Run test suite on Alpine using Bash 4.2
run: test/run-test.sh bash4-2
test-bash-5-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the docker-compose stack
run: docker-compose up -d --build
- name: Run test suite on Alpine using Bash 5
run: test/run-test.sh bash5-0
test-centos6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the docker-compose stack
run: docker-compose up -d --build
- name: Run test suite on CentOS6
run: test/run-test.sh centos6
test-centos7:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 22 additions & 0 deletions test/Dockerfile-bash4-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM bash:4.0

# https://hub.docker.com/_/bash

RUN apk --no-cache add supervisor openssl git curl bind-tools drill wget nginx bash

WORKDIR /root

# Create nginx directories in standard places
RUN mkdir /run/nginx
RUN mkdir /etc/nginx/pki
RUN mkdir /etc/nginx/pki/private

# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core --branch v1.2.1
RUN git clone https://github.com/bats-core/bats-support /bats-support
RUN git clone https://github.com/bats-core/bats-assert /bats-assert
RUN /bats-core/install.sh /usr/local

# Use supervisord to run nginx in the background
COPY ./test/test-config/alpine-supervisord.conf /etc/supervisord.conf
CMD tail -f /dev/null
22 changes: 22 additions & 0 deletions test/Dockerfile-bash4-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM bash:4.2

# https://hub.docker.com/_/bash

RUN apk --no-cache add supervisor openssl git curl bind-tools drill wget nginx bash

WORKDIR /root

# Create nginx directories in standard places
RUN mkdir /run/nginx
RUN mkdir /etc/nginx/pki
RUN mkdir /etc/nginx/pki/private

# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core --branch v1.2.1
RUN git clone https://github.com/bats-core/bats-support /bats-support
RUN git clone https://github.com/bats-core/bats-assert /bats-assert
RUN /bats-core/install.sh /usr/local

# Use supervisord to run nginx in the background
COPY ./test/test-config/alpine-supervisord.conf /etc/supervisord.conf
CMD tail -f /dev/null
22 changes: 22 additions & 0 deletions test/Dockerfile-bash5-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM bash:5.0

# https://hub.docker.com/_/bash

RUN apk --no-cache add supervisor openssl git curl bind-tools drill wget nginx bash

WORKDIR /root

# Create nginx directories in standard places
RUN mkdir /run/nginx
RUN mkdir /etc/nginx/pki
RUN mkdir /etc/nginx/pki/private

# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core --branch v1.2.1
RUN git clone https://github.com/bats-core/bats-support /bats-support
RUN git clone https://github.com/bats-core/bats-assert /bats-assert
RUN /bats-core/install.sh /usr/local

# Use supervisord to run nginx in the background
COPY ./test/test-config/alpine-supervisord.conf /etc/supervisord.conf
CMD tail -f /dev/null
8 changes: 7 additions & 1 deletion test/Dockerfile-centos6
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ FROM centos:centos6
# [wsl2]
# kernelCommandLine = vsyscall=emulate

# Centos 6 is EOL and is no longer available from the usual mirrors, so switch
# to https://vault.centos.org
RUN sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf && \
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo && \
sed -i 's;^#baseurl=http://mirror;baseurl=https://vault;g' /etc/yum.repos.d/*.repo

# Update and install required software
RUN yum -y update
#RUN yum -y update
RUN yum -y install epel-release
RUN yum -y install git curl dnsutils ldns wget nginx

Expand Down
7 changes: 7 additions & 0 deletions test/run-test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set COMMAND=%2 %3
REM check if OS *contains* staging
IF NOT x%OS:duck=%==x%OS% GOTO duckdns
IF NOT x%OS:dynu=%==x%OS% GOTO dynu
IF NOT x%OS:bash=%==x%OS% GOTO bash
set ALIAS=%OS%.getssl.test
set STAGING=
set GETSSL_OS=%OS%
Expand All @@ -34,6 +35,12 @@ GOTO Run
set ALIAS=%OS:-dynu=%-getssl.freeddns.org
set STAGING=--env STAGING=true --env dynamic_dns=dynu
set GETSSL_OS=%OS:-dynu=%
GOTO Run

:bash
set ALIAS=%OS%.getssl.test
set STAGING=
set GETSSL_OS=alpine

:Run
for %%I in (.) do set CurrDirName=%%~nxI
Expand Down
34 changes: 18 additions & 16 deletions test/run-test.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
#! /usr/bin/env bash

if [ $# -eq 0 ]; then
echo "Usage: $(basename "$0") <os> [<command>]"
echo "e.g. $(basename "$0") alpine bats /getssl/test"
exit 1
echo "Usage: $(basename "$0") <os> [<command>]"
echo "e.g. $(basename "$0") alpine bats /getssl/test"
exit 1
fi
OS=$1

if [ $# -gt 1 ]; then
shift
COMMAND=$*
shift
COMMAND=$*
else
COMMAND="bats /getssl/test --timing"
COMMAND="bats /getssl/test --timing"
fi

ALIAS="$OS.getssl.test"
STAGING=""
GETSSL_OS=$OS

if [[ "$OS" == *"duckdns"* ]]; then
ALIAS="${OS%-duckdns}-getssl.duckdns.org"
STAGING="--env STAGING=true --env dynamic_dns=duckdns"
GETSSL_OS="${OS%-duckdns}"
ALIAS="${OS%-duckdns}-getssl.duckdns.org"
STAGING="--env STAGING=true --env dynamic_dns=duckdns"
GETSSL_OS="${OS%-duckdns}"
elif [[ "$OS" == *"dynu"* ]]; then
ALIAS="${OS%-dynu}-getssl.freeddns.org"
STAGING="--env STAGING=true --env dynamic_dns=dynu"
GETSSL_OS="${OS%-dynu}"
else
ALIAS="$OS.getssl.test"
STAGING=""
GETSSL_OS=$OS
ALIAS="${OS%-dynu}-getssl.freeddns.org"
STAGING="--env STAGING=true --env dynamic_dns=dynu"
GETSSL_OS="${OS%-dynu}"
elif [[ "$OS" == "bash"* ]]; then
GETSSL_OS="alpine"
fi

docker build --rm -f "test/Dockerfile-$OS" -t "getssl-$OS" .
Expand Down

0 comments on commit e943c05

Please sign in to comment.