Browse Source

Merge pull request #621 from srvrco/bash4

Add tests for bash 4.0, 4.2, 5.0
pull/275/merge v2.33
Tim Kimber 5 years ago
committed by GitHub
parent
commit
e943c0521a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 130 additions and 17 deletions
  1. +32
    -0
      .github/workflows/run-tests-pebble.yml
  2. +22
    -0
      test/Dockerfile-bash4-0
  3. +22
    -0
      test/Dockerfile-bash4-2
  4. +22
    -0
      test/Dockerfile-bash5-0
  5. +7
    -1
      test/Dockerfile-centos6
  6. +7
    -0
      test/run-test.cmd
  7. +18
    -16
      test/run-test.sh

+ 32
- 0
.github/workflows/run-tests-pebble.yml View File

@ -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:


+ 22
- 0
test/Dockerfile-bash4-0 View File

@ -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
- 0
test/Dockerfile-bash4-2 View File

@ -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
- 0
test/Dockerfile-bash5-0 View File

@ -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

+ 7
- 1
test/Dockerfile-centos6 View File

@ -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


+ 7
- 0
test/run-test.cmd View File

@ -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%
@ -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


+ 18
- 16
test/run-test.sh View File

@ -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" .


Loading…
Cancel
Save