-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements the ginkgo integration test framework for podman. As tests are migrated from bats to ginkgo, we will still run both integration suites. When a test is migrated, we remove the tests from bats at that time. All new tests should be just for the ginkgo framework. One exception is that we only run the ginkgo suit in the travis/ubuntu environment. The CentOS and Fedora PAPR nodes will more than cover those. Signed-off-by: baude <[email protected]> Closes: #261 Approved by: baude
- Loading branch information
1 parent
562a5de
commit dd133a1
Showing
15 changed files
with
860 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,36 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
DIST=$(cat /etc/redhat-release | awk '{print $1}') | ||
IMAGE=registry.fedoraproject.org/fedora:27 | ||
PACKAGER=dnf | ||
NOTEST=${NOTEST:-0} | ||
if [[ ${DIST} != "Fedora" ]]; then | ||
PACKAGER=yum | ||
IMAGE=registry.centos.org/centos/centos:7 | ||
fi | ||
|
||
if test -z "${INSIDE_CONTAINER:-}"; then | ||
source /etc/os-release | ||
|
||
if [ -f /run/ostree-booted ]; then | ||
|
||
# by default, the root LV on AH is only 3G, but we need a | ||
# bit more for our tests. Only do resize on centos and fedora | ||
# versions less than 27 | ||
if [[ "$VERSION_ID" != "27" ]]; then | ||
lvresize -r -L +4G atomicos/root | ||
fi | ||
|
||
if [ ! -e /var/tmp/ostree-unlock-ovl.* ]; then | ||
ostree admin unlock | ||
fi | ||
fi | ||
# Restarting docker helps with permissions related to above. | ||
systemctl restart docker | ||
|
||
# somewhat mimic the spec conditional | ||
if [ "$ID" == fedora ]; then | ||
PYTHON=python3 | ||
else | ||
PYTHON=python | ||
fi | ||
docker run --rm \ | ||
--privileged \ | ||
-v $PWD:/go/src/github.com/projectatomic/libpod \ | ||
-v /etc/yum.repos.d:/etc/yum.repos.d.host:ro \ | ||
-v /usr:/host/usr \ | ||
-v /etc:/host/etc \ | ||
-v /host:/host/var \ | ||
--workdir /go/src/github.com/projectatomic/libpod \ | ||
-e INSIDE_CONTAINER=1 \ | ||
-e PYTHON=$PYTHON \ | ||
-e NOTEST=$NOTEST \ | ||
${IMAGE} /go/src/github.com/projectatomic/libpod/.papr.sh | ||
if [[ "${NOTEST}" -eq 1 ]]; then | ||
exit | ||
fi | ||
systemd-detect-virt | ||
script -qefc ./test/test_runner.sh | ||
exit 0 | ||
fi | ||
|
||
export GOPATH=/go | ||
export PATH=$HOME/gopath/bin:$PATH | ||
export GOSRC=/$GOPATH/src/github.com/projectatomic/libpod | ||
|
||
${PACKAGER} install -y \ | ||
btrfs-progs-devel \ | ||
bzip2 \ | ||
device-mapper-devel \ | ||
findutils \ | ||
git \ | ||
glib2-devel \ | ||
gnupg \ | ||
golang \ | ||
gpgme-devel \ | ||
libassuan-devel \ | ||
libseccomp-devel \ | ||
libselinux-devel \ | ||
skopeo-containers \ | ||
runc \ | ||
make \ | ||
ostree-devel \ | ||
python \ | ||
which\ | ||
golang-github-cpuguy83-go-md2man | ||
|
||
|
||
# PAPR adds a merge commit, for testing, which fails the | ||
# short-commit-subject validation test, so tell git-validate.sh to only check | ||
# up to, but not including, the merge commit. | ||
export GITVALIDATE_TIP=$(cd $GOSRC; git log -2 --pretty='%H' | tail -n 1) | ||
export TAGS="seccomp $($GOSRC/hack/btrfs_tag.sh) $($GOSRC/hack/libdm_tag.sh) $($GOSRC/hack/btrfs_installed_tag.sh) $($GOSRC/hack/ostree_tag.sh) $($GOSRC/hack/selinux_tag.sh)" | ||
|
||
if [[ "${NOTEST}" -eq 0 ]]; then | ||
make gofmt TAGS="${TAGS}" | ||
make testunit TAGS="${TAGS}" | ||
fi | ||
make gofmt TAGS="${TAGS}" | ||
make testunit TAGS="${TAGS}" | ||
|
||
make install.tools TAGS="${TAGS}" | ||
|
||
# Only check lint and gitvalidation on more recent | ||
# distros with updated git and tooling | ||
if [[ ${PACKAGER} != "yum" ]] && [[ "${NOTEST}" -eq 0 ]]; then | ||
if [[ ${DIST} == "Fedora" ]]; then | ||
HEAD=$GITVALIDATE_TIP make -C $GOSRC .gitvalidation TAGS="${TAGS}" | ||
make lint | ||
fi | ||
|
||
# Make and install podman | ||
make TAGS="${TAGS}" | ||
make TAGS="${TAGS}" install PREFIX=/host/usr ETCDIR=/host/etc | ||
make TAGS="${TAGS}" install PREFIX=/usr ETCDIR=/etc | ||
make TAGS="${TAGS}" test-binaries | ||
|
||
# Add the new bats core instead of the deprecated bats | ||
git clone https://github.com/bats-core/bats-core /bats-core | ||
cd /bats-core | ||
install -D -m 755 libexec/* /host/usr/bin/ | ||
# Run the ginkgo integration tests | ||
GOPATH=/go ginkgo test/e2e/. | ||
# Run the bats integration tests | ||
script -qefc ./test/test_runner.sh | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
DIST=$(cat /etc/redhat-release | awk '{print $1}') | ||
IMAGE=fedorapodmanbuild | ||
PYTHON=python3 | ||
if [[ ${DIST} != "Fedora" ]]; then | ||
IMAGE=centospodmanbuild | ||
PYTHON=python | ||
fi | ||
|
||
# Build the test image | ||
docker build -t ${IMAGE} -f Dockerfile.${DIST} . | ||
|
||
# Run the tests | ||
docker run --rm --privileged -v $PWD:/go/src/github.com/projectatomic/libpod --workdir /go/src/github.com/projectatomic/libpod -e PYTHON=$PYTHON -e STORAGE_OPTIONS="--storage-driver=vfs" -e CRIO_ROOT="/go/src/github.com/projectatomic/libpod" -e PODMAN_BINARY="/usr/bin/podman" -e CONMON_BINARY="/usr/libexec/crio/conmon" -e DIST=$DIST $IMAGE sh .papr.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
FROM registry.centos.org/centos/centos:7 | ||
|
||
RUN yum -y install btrfs-progs-devel \ | ||
bzip2 \ | ||
device-mapper-devel \ | ||
findutils \ | ||
git \ | ||
glib2-devel \ | ||
gnupg \ | ||
golang \ | ||
gpgme-devel \ | ||
libassuan-devel \ | ||
libseccomp-devel \ | ||
libselinux-devel \ | ||
skopeo-containers \ | ||
runc \ | ||
make \ | ||
ostree-devel \ | ||
python \ | ||
which\ | ||
golang-github-cpuguy83-go-md2man \ | ||
iptables && yum clean all | ||
|
||
# install bats | ||
RUN cd /tmp \ | ||
&& git clone https://github.com/sstephenson/bats.git \ | ||
&& cd bats \ | ||
&& git reset --hard 03608115df2071fff4eaaff1605768c275e5f81f \ | ||
&& ./install.sh /usr/local \ | ||
&& rm -fr /tmp/bats | ||
|
||
# Install CNI plugins | ||
ENV CNI_COMMIT 7480240de9749f9a0a5c8614b17f1f03e0c06ab9 | ||
RUN set -x \ | ||
&& export GOPATH="$(mktemp -d)" \ | ||
&& git clone https://github.com/containernetworking/plugins.git "$GOPATH/src/github.com/containernetworking/plugins" \ | ||
&& cd "$GOPATH/src/github.com/containernetworking/plugins" \ | ||
&& git checkout -q "$CNI_COMMIT" \ | ||
&& ./build.sh \ | ||
&& mkdir -p /usr/libexec/cni \ | ||
&& cp bin/* /usr/libexec/cni \ | ||
&& rm -rf "$GOPATH" | ||
|
||
# Install ginkgo | ||
RUN set -x \ | ||
&& export GOPATH=/go \ | ||
&& go get -u github.com/onsi/ginkgo/ginkgo \ | ||
&& install -D -m 755 "$GOPATH"/bin/ginkgo /usr/bin/ | ||
|
||
# Install gomega | ||
RUN set -x \ | ||
&& export GOPATH=/go \ | ||
&& go get github.com/onsi/gomega/... | ||
|
||
# Install conmon | ||
ENV CRIO_COMMIT 814c6ab0913d827543696b366048056a31d9529c | ||
RUN set -x \ | ||
&& export GOPATH="$(mktemp -d)" \ | ||
&& git clone https://github.com/kubernetes-incubator/cri-o.git "$GOPATH/src/github.com/kubernetes-incubator/cri-o.git" \ | ||
&& cd "$GOPATH/src/github.com/kubernetes-incubator/cri-o.git" \ | ||
&& git fetch origin --tags \ | ||
&& git checkout -q "$CRIO_COMMIT" \ | ||
&& mkdir bin \ | ||
&& make conmon \ | ||
&& install -D -m 755 bin/conmon /usr/libexec/crio/conmon \ | ||
&& rm -rf "$GOPATH" | ||
|
||
# Install cni config | ||
#RUN make install.cni | ||
RUN mkdir -p /etc/cni/net.d/ | ||
COPY cni/87-podman-bridge.conflist /etc/cni/net.d/87-podman-bridge.conflist | ||
|
||
# Make sure we have some policy for pulling images | ||
RUN mkdir -p /etc/containers | ||
COPY test/policy.json /etc/containers/policy.json | ||
COPY test/redhat_sigstore.yaml /etc/containers/registries.d/registry.access.redhat.com.yaml | ||
|
||
WORKDIR /go/src/github.com/projectatomic/libpod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
FROM registry.fedoraproject.org/fedora:27 | ||
|
||
RUN dnf -y install btrfs-progs-devel \ | ||
bzip2 \ | ||
device-mapper-devel \ | ||
findutils \ | ||
git \ | ||
glib2-devel \ | ||
gnupg \ | ||
golang \ | ||
gpgme-devel \ | ||
libassuan-devel \ | ||
libseccomp-devel \ | ||
libselinux-devel \ | ||
skopeo-containers \ | ||
runc \ | ||
make \ | ||
ostree-devel \ | ||
python \ | ||
which\ | ||
golang-github-cpuguy83-go-md2man \ | ||
crio \ | ||
procps-ng \ | ||
iptables && dnf clean all | ||
|
||
# install bats | ||
RUN cd /tmp \ | ||
&& git clone https://github.com/sstephenson/bats.git \ | ||
&& cd bats \ | ||
&& git reset --hard 03608115df2071fff4eaaff1605768c275e5f81f \ | ||
&& ./install.sh /usr/local \ | ||
&& rm -fr /tmp/bats | ||
|
||
# Install CNI plugins | ||
ENV CNI_COMMIT 7480240de9749f9a0a5c8614b17f1f03e0c06ab9 | ||
RUN set -x \ | ||
&& export GOPATH="$(mktemp -d)" \ | ||
&& git clone https://github.com/containernetworking/plugins.git "$GOPATH/src/github.com/containernetworking/plugins" \ | ||
&& cd "$GOPATH/src/github.com/containernetworking/plugins" \ | ||
&& git checkout -q "$CNI_COMMIT" \ | ||
&& ./build.sh \ | ||
&& mkdir -p /usr/libexec/cni \ | ||
&& cp bin/* /usr/libexec/cni \ | ||
&& rm -rf "$GOPATH" | ||
|
||
# Install ginkgo | ||
RUN set -x \ | ||
&& export GOPATH=/go \ | ||
&& go get -u github.com/onsi/ginkgo/ginkgo \ | ||
&& install -D -m 755 "$GOPATH"/bin/ginkgo /usr/bin/ | ||
|
||
# Install gomega | ||
RUN set -x \ | ||
&& export GOPATH=/go \ | ||
&& go get github.com/onsi/gomega/... | ||
|
||
# Install cni config | ||
#RUN make install.cni | ||
RUN mkdir -p /etc/cni/net.d/ | ||
COPY cni/87-podman-bridge.conflist /etc/cni/net.d/87-podman-bridge.conflist | ||
|
||
# Make sure we have some policy for pulling images | ||
RUN mkdir -p /etc/containers | ||
COPY test/policy.json /etc/containers/policy.json | ||
COPY test/redhat_sigstore.yaml /etc/containers/registries.d/registry.access.redhat.com.yaml | ||
|
||
WORKDIR /go/src/github.com/projectatomic/libpod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.