mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
test: add test-containerd
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp> Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
43ac05e4dd
commit
4699f80ef7
@ -1,4 +1,4 @@
|
|||||||
FROM linuxkit/alpine:7cf5393e04fe0e26e9fa8f507379cacb64595918 as alpine
|
FROM linuxkit/alpine:24fe1b6bbf1fc95b484741587acb10da6dbc9211 as alpine
|
||||||
RUN \
|
RUN \
|
||||||
apk add \
|
apk add \
|
||||||
btrfs-progs-dev \
|
btrfs-progs-dev \
|
||||||
@ -10,11 +10,11 @@ RUN \
|
|||||||
make \
|
make \
|
||||||
&& true
|
&& true
|
||||||
ENV GOPATH=/go PATH=$PATH:/go/bin
|
ENV GOPATH=/go PATH=$PATH:/go/bin
|
||||||
ENV CONTAINERD_COMMIT=c215531a8f63a98a69134e804fea4ee6d354bb90
|
|
||||||
RUN mkdir -p $GOPATH/src/github.com/containerd && \
|
RUN mkdir -p $GOPATH/src/github.com/containerd && \
|
||||||
cd $GOPATH/src/github.com/containerd && \
|
cd $GOPATH/src/github.com/containerd && \
|
||||||
git clone https://github.com/containerd/containerd.git
|
git clone https://github.com/containerd/containerd.git
|
||||||
WORKDIR $GOPATH/src/github.com/containerd/containerd
|
WORKDIR $GOPATH/src/github.com/containerd/containerd
|
||||||
|
# CONTAINERD_COMMIT is defined in linuxkit/alpine
|
||||||
RUN git checkout $CONTAINERD_COMMIT
|
RUN git checkout $CONTAINERD_COMMIT
|
||||||
RUN make binaries EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS="-extldflags \\\"-fno-PIC -static\\\""
|
RUN make binaries EXTRA_FLAGS="-buildmode pie" EXTRA_LDFLAGS="-extldflags \\\"-fno-PIC -static\\\""
|
||||||
RUN cp bin/containerd bin/ctr bin/containerd-shim bin/dist /usr/bin/
|
RUN cp bin/containerd bin/ctr bin/containerd-shim bin/dist /usr/bin/
|
||||||
|
19
test/cases/040_packages/020_containerd/test-containerd.yml
Normal file
19
test/cases/040_packages/020_containerd/test-containerd.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
kernel:
|
||||||
|
image: "linuxkit/kernel:4.9.x"
|
||||||
|
cmdline: "console=ttyS0 page_poison=1"
|
||||||
|
init:
|
||||||
|
- linuxkit/init:17693d233dd009b2a3a8d23673cb85969e1dce80
|
||||||
|
- linuxkit/runc:3a4e6cbf15470f62501b019b55e1caac5ee7689f
|
||||||
|
- linuxkit/containerd:be69ded7ed4437e2989da850581b631bac877d3e
|
||||||
|
- linuxkit/ca-certificates:75cf419fb58770884c3464eb687ec8dfc704169d
|
||||||
|
onboot:
|
||||||
|
- name: sysctl
|
||||||
|
image: "linuxkit/sysctl:3aa6bc663c2849ef239be7d941d3eaf3e6fcc018"
|
||||||
|
- name: test
|
||||||
|
image: "test-containerd:latest" # maintainers please push and update
|
||||||
|
- name: poweroff
|
||||||
|
image: "linuxkit/poweroff:7404cf2295df89ccfa2dda41997a28307a90cf28"
|
||||||
|
trust:
|
||||||
|
org:
|
||||||
|
- linuxkit
|
||||||
|
|
22
test/cases/040_packages/020_containerd/test.sh
Normal file
22
test/cases/040_packages/020_containerd/test.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SUMMARY: Run contianerd test
|
||||||
|
# LABELS:
|
||||||
|
# REPEAT:
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Source libraries. Uncomment if needed/defined
|
||||||
|
#. "${RT_LIB}"
|
||||||
|
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
find . -iname "test-containerd*" -not -iname "*.yml" -exec rm -rf {} \;
|
||||||
|
}
|
||||||
|
trap clean_up EXIT
|
||||||
|
|
||||||
|
# Test code goes here
|
||||||
|
moby build test-containerd.yml
|
||||||
|
RESULT="$(linuxkit run -mem 2048 test-containerd)"
|
||||||
|
echo "${RESULT}" | grep -q "suite PASSED"
|
||||||
|
|
||||||
|
exit 0
|
32
test/pkg/containerd/Dockerfile
Normal file
32
test/pkg/containerd/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
FROM linuxkit/alpine:24fe1b6bbf1fc95b484741587acb10da6dbc9211 AS mirror
|
||||||
|
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
||||||
|
# btrfs-progfs is required for btrfs test (mkfs.btrfs)
|
||||||
|
# util-linux is required for btrfs test (losetup)
|
||||||
|
RUN apk add --no-cache --initdb -p /out \
|
||||||
|
alpine-baselayout \
|
||||||
|
busybox \
|
||||||
|
btrfs-progs \
|
||||||
|
btrfs-progs-dev \
|
||||||
|
gcc \
|
||||||
|
git \
|
||||||
|
go \
|
||||||
|
libc-dev \
|
||||||
|
linux-headers \
|
||||||
|
make \
|
||||||
|
musl \
|
||||||
|
util-linux
|
||||||
|
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=mirror /out/ /
|
||||||
|
ENV GOPATH=/go
|
||||||
|
RUN mkdir -p $GOPATH/src/github.com/containerd && \
|
||||||
|
cd $GOPATH/src/github.com/containerd && \
|
||||||
|
git clone https://github.com/containerd/containerd.git
|
||||||
|
WORKDIR $GOPATH/src/github.com/containerd/containerd
|
||||||
|
# CONTAINERD_COMMIT is defined in linuxkit/alpine
|
||||||
|
RUN git checkout $CONTAINERD_COMMIT
|
||||||
|
ADD run.sh ./run.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/sh", "run.sh"]
|
||||||
|
LABEL org.mobyproject.config='{"net": "host", "capabilities": ["all"], "tmpfs": ["/tmp:exec"], "binds": ["/dev:/dev"]}'
|
15
test/pkg/containerd/Makefile
Normal file
15
test/pkg/containerd/Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
.PHONY: tag push
|
||||||
|
default: push
|
||||||
|
|
||||||
|
ORG?=linuxkit
|
||||||
|
IMAGE=test-containerd
|
||||||
|
DEPS=Dockerfile Makefile run.sh
|
||||||
|
|
||||||
|
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
|
||||||
|
|
||||||
|
tag: $(DEPS)
|
||||||
|
docker build --squash --no-cache -t $(ORG)/$(IMAGE):$(HASH) .
|
||||||
|
|
||||||
|
push: tag
|
||||||
|
DOCKER_CONTENT_TRUST=1 docker pull $(ORG)/$(IMAGE):$(HASH) || \
|
||||||
|
DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(HASH)
|
11
test/pkg/containerd/run.sh
Executable file
11
test/pkg/containerd/run.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function failed {
|
||||||
|
printf "containerd test suite FAILED\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# unset -race (does not work on alpine; see golang/go#14481)
|
||||||
|
export TESTFLAGS=
|
||||||
|
make root-test || failed
|
||||||
|
printf "containerd test suite PASSED\n"
|
@ -54,3 +54,5 @@ COPY --from=shellcheck /usr/local/bin/shellcheck /usr/local/bin/shellcheck
|
|||||||
COPY --from=shellcheck /usr/local/lib/ /usr/local/lib/
|
COPY --from=shellcheck /usr/local/lib/ /usr/local/lib/
|
||||||
|
|
||||||
RUN apk update && apk upgrade -a
|
RUN apk update && apk upgrade -a
|
||||||
|
|
||||||
|
ARG CONTAINERD_COMMIT=c215531a8f63a98a69134e804fea4ee6d354bb90
|
||||||
|
@ -49,7 +49,7 @@ glib-2.52.1-r0
|
|||||||
gmp-6.1.2-r0
|
gmp-6.1.2-r0
|
||||||
gmp-dev-6.1.2-r0
|
gmp-dev-6.1.2-r0
|
||||||
gnutls-3.5.13-r0
|
gnutls-3.5.13-r0
|
||||||
go-1.8.1-r0
|
go-1.8.1-r2
|
||||||
gummiboot-48.1-r0
|
gummiboot-48.1-r0
|
||||||
hvtools-4.4.15-r0
|
hvtools-4.4.15-r0
|
||||||
icu-libs-58.2-r2
|
icu-libs-58.2-r2
|
||||||
@ -130,7 +130,7 @@ lzo-2.10-r0
|
|||||||
m4-1.4.18-r0
|
m4-1.4.18-r0
|
||||||
make-4.2.1-r0
|
make-4.2.1-r0
|
||||||
mesa-gbm-17.0.3-r1
|
mesa-gbm-17.0.3-r1
|
||||||
mkinitfs-3.1.0_rc1-r0
|
mkinitfs-3.1.0-r0
|
||||||
mpc1-1.0.3-r0
|
mpc1-1.0.3-r0
|
||||||
mpfr3-3.1.5-r0
|
mpfr3-3.1.5-r0
|
||||||
mtools-4.0.18-r1
|
mtools-4.0.18-r1
|
||||||
|
Loading…
Reference in New Issue
Block a user