Skip to content

Commit b213648

Browse files
authored
Merge pull request containerd#1219 from Random-Liu/rename-test-containerd-bin
Rename the test binary to containerd-test.
2 parents a997666 + 7665f4a commit b213648

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

hack/test-integration.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ test_setup ${REPORT_DIR}
3636
sudo PATH=${PATH} ${ROOT}/_output/integration.test --test.run="${FOCUS}" --test.v \
3737
--cri-endpoint=${CONTAINERD_SOCK} \
3838
--cri-root=${CRI_ROOT} \
39-
--runtime-handler=${RUNTIME}
39+
--runtime-handler=${RUNTIME} \
40+
--containerd-bin=${CONTAINERD_BIN}
4041

4142
test_exit_code=$?
4243

hack/test-utils.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ CONTAINERD_ROOT=${CONTAINERD_ROOT:-"/var/lib/containerd${CONTAINERD_TEST_SUFFIX}
3232
CONTAINERD_STATE=${CONTAINERD_STATE:-"/run/containerd${CONTAINERD_TEST_SUFFIX}"}
3333
# The containerd socket address.
3434
CONTAINERD_SOCK=${CONTAINERD_SOCK:-unix://${CONTAINERD_STATE}/containerd.sock}
35+
# The containerd binary name.
36+
CONTAINERD_BIN=${CONTAINERD_BIN:-"containerd${CONTAINERD_TEST_SUFFIX}"}
3537
if [ -f "${CONTAINERD_CONFIG_FILE}" ]; then
3638
CONTAINERD_FLAGS+="--config ${CONTAINERD_CONFIG_FILE} "
3739
fi
@@ -49,10 +51,13 @@ test_setup() {
4951
echo "containerd is not built"
5052
exit 1
5153
fi
54+
# rename the test containerd binary, so that we can easily
55+
# distinguish it.
56+
cp ${ROOT}/_output/containerd ${ROOT}/_output/${CONTAINERD_BIN}
5257
set -m
5358
# Create containerd in a different process group
5459
# so that we can easily clean them up.
55-
keepalive "sudo PATH=${PATH} ${ROOT}/_output/containerd ${CONTAINERD_FLAGS}" \
60+
keepalive "sudo PATH=${PATH} ${ROOT}/_output/${CONTAINERD_BIN} ${CONTAINERD_FLAGS}" \
5661
${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
5762
pid=$!
5863
set +m

integration/test_utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var (
6060
var criEndpoint = flag.String("cri-endpoint", "unix:///run/containerd/containerd.sock", "The endpoint of cri plugin.")
6161
var criRoot = flag.String("cri-root", "/var/lib/containerd/io.containerd.grpc.v1.cri", "The root directory of cri plugin.")
6262
var runtimeHandler = flag.String("runtime-handler", "", "The runtime handler to use in the test.")
63+
var containerdBin = flag.String("containerd-bin", "containerd", "The containerd binary name. The name is used to restart containerd during test.")
6364

6465
func init() {
6566
flag.Parse()
@@ -395,12 +396,12 @@ func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, err
395396
}
396397

397398
func RestartContainerd(t *testing.T) {
398-
require.NoError(t, KillProcess("containerd"))
399+
require.NoError(t, KillProcess(*containerdBin))
399400

400401
// Use assert so that the 3rd wait always runs, this makes sure
401402
// containerd is running before this function returns.
402403
assert.NoError(t, Eventually(func() (bool, error) {
403-
pid, err := PidOf("containerd")
404+
pid, err := PidOf(*containerdBin)
404405
if err != nil {
405406
return false, err
406407
}

0 commit comments

Comments
 (0)