Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1219 from Random-Liu/rename-test-containerd-bin
Browse files Browse the repository at this point in the history
Rename the test binary to containerd-test.
  • Loading branch information
Random-Liu committed Aug 5, 2019
2 parents a997666 + 7665f4a commit b213648
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion hack/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ test_setup ${REPORT_DIR}
sudo PATH=${PATH} ${ROOT}/_output/integration.test --test.run="${FOCUS}" --test.v \
--cri-endpoint=${CONTAINERD_SOCK} \
--cri-root=${CRI_ROOT} \
--runtime-handler=${RUNTIME}
--runtime-handler=${RUNTIME} \
--containerd-bin=${CONTAINERD_BIN}

test_exit_code=$?

Expand Down
7 changes: 6 additions & 1 deletion hack/test-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ CONTAINERD_ROOT=${CONTAINERD_ROOT:-"/var/lib/containerd${CONTAINERD_TEST_SUFFIX}
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}"}
if [ -f "${CONTAINERD_CONFIG_FILE}" ]; then
CONTAINERD_FLAGS+="--config ${CONTAINERD_CONFIG_FILE} "
fi
Expand All @@ -49,10 +51,13 @@ test_setup() {
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 ${CONTAINERD_FLAGS}" \
keepalive "sudo PATH=${PATH} ${ROOT}/_output/${CONTAINERD_BIN} ${CONTAINERD_FLAGS}" \
${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
pid=$!
set +m
Expand Down
5 changes: 3 additions & 2 deletions integration/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
var criEndpoint = flag.String("cri-endpoint", "unix:///run/containerd/containerd.sock", "The endpoint of cri plugin.")
var criRoot = flag.String("cri-root", "/var/lib/containerd/io.containerd.grpc.v1.cri", "The root directory of cri plugin.")
var runtimeHandler = flag.String("runtime-handler", "", "The runtime handler to use in the test.")
var containerdBin = flag.String("containerd-bin", "containerd", "The containerd binary name. The name is used to restart containerd during test.")

func init() {
flag.Parse()
Expand Down Expand Up @@ -395,12 +396,12 @@ func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, err
}

func RestartContainerd(t *testing.T) {
require.NoError(t, KillProcess("containerd"))
require.NoError(t, KillProcess(*containerdBin))

// Use assert so that the 3rd wait always runs, this makes sure
// containerd is running before this function returns.
assert.NoError(t, Eventually(func() (bool, error) {
pid, err := PidOf("containerd")
pid, err := PidOf(*containerdBin)
if err != nil {
return false, err
}
Expand Down

0 comments on commit b213648

Please sign in to comment.