Add testing infrastructure

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
This commit is contained in:
Eli Uriegas 2017-06-16 13:35:07 -07:00
parent 87d90102ff
commit de9757bd6b
3 changed files with 100 additions and 0 deletions

42
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,42 @@
#!groovy
properties(
[
buildDiscarder(logRotator(numToKeepStr: '20')),
parameters([
string(defaultValue: '', description: 'Expected docker version output of --version flag.', name: 'EXPECTED_VERSION'),
string(defaultValue: '', description: 'Expected docker gitcommit output of --version flag.', name: 'EXPECTED_GITCOMMIT'),
])
]
)
def verifyTargets = [
'verify-install-centos-7',
'verify-install-fedora-24',
'verify-install-fedora-25',
'verify-install-debian-wheezy',
'verify-install-debian-jessie',
'verify-install-debian-stretch',
'verify-install-ubuntu-trusty',
'verify-install-ubuntu-xenial',
'verify-install-ubuntu-yakkety',
'verify-install-ubuntu-zesty',
]
def genVerifyJob(String t) {
return [ "${t}" : { ->
stage("${t}") {
wrappedNode(label: 'aufs', cleanWorkspace: true) {
checkout scm
sh("make clean ${t}.log")
archiveArtifacts '*.log'
}
}
} ]
}
def verifyJobs = [:]
for (t in verifyTargets) {
verifyJobs << genVerifyJob(t)
}
parallel(verifyJobs)

29
Makefile Normal file
View File

@ -0,0 +1,29 @@
SHELL:=/bin/bash
VERIFY_INSTALL_DISTROS:=$(addprefix verify-install-,centos-7 fedora-24 fedora-25 debian-wheezy debian-jessie debian-stretch ubuntu-trusty ubuntu-xenial ubuntu-yakkety ubuntu-zesty)
EXPECTED_VERSION?=
EXPECTED_GITCOMMIT?=
needs_version:
ifndef EXPECTED_VERSION
$(error EXPECTED_VERSION is undefined)
endif
needs_gitcommit:
ifndef EXPECTED_GITCOMMIT
$(error EXPECTED_GITCOMMIT is undefined)
endif
check: $(VERIFY_INSTALL_DISTROS)
clean:
$(RM) *.log
verify-install-%.log: needs_version needs_gitcommit
set -o pipefail && docker run \
--rm \
-v $(CURDIR):/v \
-w /v \
$(subst -,:,$*) \
bash verify-docker-install "$(EXPECTED_VERSION)" "$(EXPECTED_GITCOMMIT)" | tee $@
# TODO: Add a target for uploading final script to s3

29
verify-docker-install Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash -e
expected_version=$1
expected_gitcommit=$2
(
echo "Executing installation script!"
sh install.sh
)
docker_version=$(docker --version)
if [ $? -ne 0 ]; then
echo "ERROR: Did Docker get installed?"
exit 3
fi
installed_version=$(echo $docker_version | awk '{print$3}')
installed_gitcommit=$(echo $docker_version | awk '{print$5}')
echo $docker_version
echo -n "Checking if installed version '$installed_version' matches '$expected_version'... "
if [[ "$installed_version" =~ "$expected_version" ]]; then
echo "PASSED!"
else
echo "FAILED!"
exit 1
fi
echo -n "Checking if installed gitcommit '$installed_gitcommit' matches '$expected_gitcommit'... "
if [[ "$installed_gitcommit" =~ "$expected_gitcommit" ]]; then
echo "PASSED!"
else
echo "FAILED!"
exit 2
fi