tests: Add back the hack for running tests on GCP

These tests should be run via rtf but currently are
run via linuxkit-ci. This is a hack and hopefully is now
marked more clearly as such.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer
2017-05-16 12:02:07 +01:00
parent 509be016d2
commit b03beb94ef
3 changed files with 75 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
default: check-deps test default: check-deps test
pr: check-deps test-pr pr: check-deps test-pr
# TODO: all should point to test-all once ltp is no longer required # TODO: should have a separate target
all: check-deps test-pr ltp all: check-deps test-pr ltp
MOBY:=$(shell command -v moby 2> /dev/null) MOBY:=$(shell command -v moby 2> /dev/null)
@@ -24,6 +24,15 @@ endif
# TODO: Remove this section once we no longer depend on this in CI # TODO: Remove this section once we no longer depend on this in CI
### ------- ### -------
# Currently the linuxkit-ci runs GCP tests outside of rtf and expects some
# files in ../artifacts. This hacky target puts them there until
# the CI can use rtf for running GCP tests
gcp-hack: ../artifacts/test.img.tar.gz
../artifacts/test.img.tar.gz:
rm -rf ../artifacts
mkdir -p ../artifacts
$(MOBY) build --pull -name ../artifacts/test hack/test.yml
define check_test_log define check_test_log
@cat $1 |grep -q 'test suite PASSED' @cat $1 |grep -q 'test suite PASSED'
endef endef
@@ -31,17 +40,14 @@ endef
.PHONY: ltp .PHONY: ltp
ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp
ltp: $(LINUXKIT) test-ltp.img.tar.gz ltp: $(LINUXKIT) test-ltp.img.tar.gz
$(MOBY) build --pull cases/020_stress/000_ltp/test-ltp.yml $(MOBY) build --pull hack/test-ltp.yml
$(LINUXKIT) push gcp test-ltp.img.tar.gz $(LINUXKIT) push gcp test-ltp.img.tar.gz
$(LINUXKIT) run gcp -skip-cleanup -machine n1-highcpu-4 $(CLOUDSDK_IMAGE_NAME) | tee test-ltp.log $(LINUXKIT) run gcp -skip-cleanup -machine n1-highcpu-4 $(CLOUDSDK_IMAGE_NAME) | tee test-ltp.log
$(call check_test_log, test-ltp.log) $(call check_test_log, test-ltp.log)
### ------ ### ------
test: test: gcp-hack
@rtf -l build -x run @rtf -l build -x run
test-pr: test-pr: gcp-hack
@rtf -vvv -l build -x run @rtf -vvv -l build -x run
test-all:
@rtf -vvv -x -l build,slow run

28
test/hack/test-ltp.yml Normal file
View File

@@ -0,0 +1,28 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0"
init:
- linuxkit/init:b3740303f3d1e5689a84c87b7dfb48fd2a40a192
- linuxkit/runc:47b1c38d63468c0f3078f8b1b055d07965a1895d
- linuxkit/containerd:cf2614f5a96c569a0bd4bd54e054a65ba17d167f
- linuxkit/ca-certificates:3344cdca1bc59fdfa17bd7f0fcbf491b9dbaa288
onboot:
- name: ltp
image: "linuxkit/test-ltp-20170116:81229df2d25065b06f0a3071faaace8d66c87e67"
net: host
pid: host
binds:
- /etc/ltp/baseline:/etc/ltp/baseline
capabilities:
- all
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host
capabilities:
- CAP_SYS_BOOT
readonly: true
files:
- path: /etc/ltp/baseline
contents: "100"
outputs:
- format: gcp-img

34
test/hack/test.yml Normal file
View File

@@ -0,0 +1,34 @@
# FIXME: This should use the minimal example
# We continue to use the kernel-config-test as CI is currently expecting to see a success message
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0"
init:
- linuxkit/init:deea956a9ab07bf262083e93a86930bdc610cc2f
- linuxkit/runc:2649198589ef0020d99f613adaeda45ce0093a38
- linuxkit/containerd:cf2614f5a96c569a0bd4bd54e054a65ba17d167f
- linuxkit/ca-certificates:3344cdca1bc59fdfa17bd7f0fcbf491b9dbaa288
onboot:
- name: dhcpcd
image: "linuxkit/dhcpcd:2def74ab3f9233b4c09ebb196ba47c27c08b0ed8"
binds:
- /var:/var
- /tmp:/etc
capabilities:
- CAP_NET_ADMIN
- CAP_NET_BIND_SERVICE
- CAP_NET_RAW
net: host
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: check-kernel-config
image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c"
readonly: true
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
pid: host
command: ["/bin/sh", "/poweroff.sh", "3"]
capabilities:
- CAP_SYS_BOOT
readonly: true
outputs:
- format: gcp-img