From df8ccb53b015d20e6a835777f4c509b53ea4ed2c Mon Sep 17 00:00:00 2001 From: xingweizheng Date: Mon, 10 Jan 2022 19:37:41 +0800 Subject: [PATCH 05/20] add integration_test_image_name_conflict_with_image_id testcase --- ..._test_image_name_conflict_with_image_id.sh | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/src/integration_test_image_name_conflict_with_image_id.sh diff --git a/tests/src/integration_test_image_name_conflict_with_image_id.sh b/tests/src/integration_test_image_name_conflict_with_image_id.sh new file mode 100644 index 0000000..2c436a0 --- /dev/null +++ b/tests/src/integration_test_image_name_conflict_with_image_id.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved. +# isula-build licensed under the Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# http://license.coscl.org.cn/MulanPSL2 +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR +# PURPOSE. +# See the Mulan PSL v2 for more details. +# Author: Weizheng Xing +# Create: 2022-01-10 +# Description: test delete and save image well behaved when the [image]:tag of one image, +# image is prefix of other image id and tag is latest, such as [othershortid]:latest + +top_dir=$(git rev-parse --show-toplevel) +# shellcheck disable=SC1091 +source "$top_dir"/tests/lib/common.sh + +image_name=build-from-scratch +context_dir="$top_dir"/tests/data/build-from-scratch + +function pre_test() { + temp_tar_short=$(mktemp -u --suffix=.tar) + temp_tar_double_short=$(mktemp -u --suffix=.tar) +} + +function clean() { + systemd_run_command "isula-build ctr-img rm $image_name:latest2" + rm -f "$temp_tar_short" + rm -f "$temp_tar_double_short" +} + +function do_test() { + systemd_run_command "isula-build ctr-img build -t $image_name:latest1 $context_dir" + systemd_run_command "isula-build ctr-img build -t $image_name:latest2 $context_dir" + image_id2=$(grep