Merge pull request #4639 from mikebrow/enable-cri-integration
getting cri integration up and running
This commit is contained in:
commit
b8ed26b66c
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -368,7 +368,12 @@ jobs:
|
||||
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu
|
||||
working-directory: src/github.com/containerd/containerd
|
||||
|
||||
- name: CRI test
|
||||
- name: CRI Integration Test
|
||||
run: |
|
||||
make cri-integration
|
||||
working-directory: src/github.com/containerd/containerd
|
||||
|
||||
- name: cri-tools critest
|
||||
env:
|
||||
TEST_RUNTIME: ${{ matrix.runtime }}
|
||||
run: |
|
||||
|
14
Makefile
14
Makefile
@ -125,7 +125,7 @@ TESTFLAGS_PARALLEL ?= 8
|
||||
OUTPUTDIR = $(join $(ROOTDIR), _output)
|
||||
CRIDIR=$(OUTPUTDIR)/cri
|
||||
|
||||
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install uninstall vendor release mandir install-man genman install-cri-deps cri-release cri-cni-release
|
||||
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install uninstall vendor release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration bin/cri-integration.test
|
||||
.DEFAULT: default
|
||||
|
||||
all: binaries
|
||||
@ -182,6 +182,16 @@ integration: ## run integration tests
|
||||
@echo "$(WHALE) $@"
|
||||
@go test ${TESTFLAGS} -test.root -parallel ${TESTFLAGS_PARALLEL}
|
||||
|
||||
# TODO integrate cri integration bucket with coverage
|
||||
bin/cri-integration.test:
|
||||
@echo "$(WHALE) $@"
|
||||
@go test -c ./integration -o bin/cri-integration.test
|
||||
|
||||
cri-integration: binaries bin/cri-integration.test ## run cri integration tests
|
||||
@echo "$(WHALE) $@"
|
||||
@./hack/test-cri-integration.sh
|
||||
@rm -rf bin/cri-integration.test
|
||||
|
||||
benchmark: ## run benchmarks tests
|
||||
@echo "$(WHALE) $@"
|
||||
@go test ${TESTFLAGS} -bench . -run Benchmark -test.root
|
||||
@ -309,6 +319,7 @@ clean: ## clean up binaries
|
||||
@rm -f $(BINARIES)
|
||||
@rm -f releases/*.tar.gz*
|
||||
@rm -rf $(OUTPUTDIR)
|
||||
@rm -rf bin/cri-integration.test
|
||||
|
||||
clean-test: ## clean up debris from previously failed tests
|
||||
@echo "$(WHALE) $@"
|
||||
@ -323,6 +334,7 @@ clean-test: ## clean up debris from previously failed tests
|
||||
@rm -rf /run/containerd/runc/*
|
||||
@rm -rf /run/containerd/fifo/*
|
||||
@rm -rf /run/containerd-test/*
|
||||
@rm -rf bin/cri-integration.test
|
||||
|
||||
install: ## install binaries
|
||||
@echo "$(WHALE) $@ $(BINARIES)"
|
||||
|
@ -33,7 +33,7 @@ mkdir -p ${REPORT_DIR}
|
||||
test_setup ${REPORT_DIR}
|
||||
|
||||
# Run integration test.
|
||||
sudo PATH=${PATH} ${ROOT}/_output/integration.test --test.run="${FOCUS}" --test.v \
|
||||
sudo PATH=${PATH} bin/cri-integration.test --test.run="${FOCUS}" --test.v \
|
||||
--cri-endpoint=${CONTAINERD_SOCK} \
|
||||
--cri-root=${CRI_ROOT} \
|
||||
--runtime-handler=${RUNTIME} \
|
@ -42,7 +42,7 @@ CONTAINERD_STATE=${CONTAINERD_STATE:-"/run/containerd${CONTAINERD_TEST_SUFFIX}"}
|
||||
# The containerd socket address.
|
||||
CONTAINERD_SOCK=${CONTAINERD_SOCK:-unix://${CONTAINERD_STATE}/containerd.sock}
|
||||
# The containerd binary name.
|
||||
CONTAINERD_BIN=${CONTAINERD_BIN:-"containerd${CONTAINERD_TEST_SUFFIX}"}
|
||||
CONTAINERD_BIN=${CONTAINERD_BIN:-"containerd"} # don't need a suffix now
|
||||
if [ -f "${CONTAINERD_CONFIG_FILE}" ]; then
|
||||
CONTAINERD_FLAGS+="--config ${CONTAINERD_CONFIG_FILE} "
|
||||
fi
|
||||
@ -56,34 +56,26 @@ containerd_groupid=
|
||||
test_setup() {
|
||||
local report_dir=$1
|
||||
# Start containerd
|
||||
if [ ! -x "${ROOT}/_output/containerd" ]; then
|
||||
if [ ! -x "bin/containerd" ]; then
|
||||
echo "containerd is not built"
|
||||
exit 1
|
||||
fi
|
||||
# rename the test containerd binary, so that we can easily
|
||||
# distinguish it.
|
||||
cp ${ROOT}/_output/containerd ${ROOT}/_output/${CONTAINERD_BIN}
|
||||
set -m
|
||||
# Create containerd in a different process group
|
||||
# so that we can easily clean them up.
|
||||
keepalive "sudo PATH=${PATH} ${ROOT}/_output/${CONTAINERD_BIN} ${CONTAINERD_FLAGS}" \
|
||||
keepalive "sudo PATH=${PATH} bin/containerd ${CONTAINERD_FLAGS}" \
|
||||
${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
|
||||
pid=$!
|
||||
set +m
|
||||
containerd_groupid=$(ps -o pgid= -p ${pid})
|
||||
# Wait for containerd to be running by using the containerd client ctr to check the version
|
||||
# of the containerd server. Wait an increasing amount of time after each of five attempts
|
||||
local -r ctr_path=$(which ctr)
|
||||
if [ -z "${ctr_path}" ]; then
|
||||
echo "ctr is not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
local -r crictl_path=$(which crictl)
|
||||
if [ -z "${crictl_path}" ]; then
|
||||
echo "crictl is not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
readiness_check "sudo ${ctr_path} --address ${CONTAINERD_SOCK#"unix://"} version"
|
||||
readiness_check "sudo bin/ctr --address ${CONTAINERD_SOCK#"unix://"} version"
|
||||
readiness_check "sudo ${crictl_path} --runtime-endpoint=${CONTAINERD_SOCK} info"
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ func KillPid(pid int) error {
|
||||
|
||||
// PidOf returns pid of a process by name.
|
||||
func PidOf(name string) (int, error) {
|
||||
b, err := exec.Command("pidof", name).CombinedOutput()
|
||||
b, err := exec.Command("pidof", "-s", name).CombinedOutput()
|
||||
output := strings.TrimSpace(string(b))
|
||||
if err != nil {
|
||||
if len(output) != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user