From de536c649a64fa2cdae5b027a9b15a660fdf982d Mon Sep 17 00:00:00 2001 From: Hoogervorst Date: Thu, 3 Oct 2019 21:51:40 +0200 Subject: [PATCH] add test for ordering of commits when using path filter and ci-skip disabled Signed-off-by: Hoogervorst --- test/check.sh | 16 +++++++++++++++- test/helpers.sh | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test/check.sh b/test/check.sh index 3cf438a0..5dd1f055 100755 --- a/test/check.sh +++ b/test/check.sh @@ -105,7 +105,6 @@ it_can_check_from_a_ref() { local ref1=$(make_commit $repo) local ref2=$(make_commit $repo) local ref3=$(make_commit $repo) - check_uri_from $repo $ref1 check_uri_from $repo $ref1 | jq -e " . == [ {ref: $(echo $ref1 | jq -R .)}, @@ -263,6 +262,20 @@ it_checks_given_paths() { " } +it_checks_given_paths_ci_skip_disabled() { + local repo=$(init_repo) + local ref1=$(make_commit_to_file $repo file-a) + local ref2=$(make_commit_to_file $repo file-a) + local ref3=$(make_commit_to_file $repo file-a) + check_uri_from_paths_disable_ci_skip $repo $ref1 "file-a" | jq -e " + . == [ + {ref: $(echo $ref1 | jq -R .)}, + {ref: $(echo $ref2 | jq -R .)}, + {ref: $(echo $ref3 | jq -R .)} + ] +" +} + it_checks_given_paths_on_branch() { local repo=$(init_repo) local ref1=$(make_commit_to_file_on_branch_with_path $repo dummy file-b master) @@ -673,6 +686,7 @@ run it_can_check_from_a_first_commit_in_repo run it_can_check_from_a_bogus_sha run it_skips_ignored_paths run it_checks_given_paths +run it_checks_given_paths_ci_skip_disabled run it_checks_given_paths_on_branch run it_checks_given_glob_paths run it_checks_given_ignored_paths diff --git a/test/helpers.sh b/test/helpers.sh index 9d7fc5a3..a6b3f8e0 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -363,6 +363,24 @@ check_uri_from_ignoring() { }" | ${resource_dir}/check | tee /dev/stderr } +check_uri_from_paths_disable_ci_skip() { + local uri=$1 + local ref=$2 + + shift 2 + + jq -n "{ + source: { + uri: $(echo $uri | jq -R .), + paths: $(echo "$@" | jq -R '. | split(" ")'), + disable_ci_skip: true + }, + version: { + ref: $(echo $ref | jq -R .) + } + }" | ${resource_dir}/check | tee /dev/stderr +} + check_uri_from_paths() { local uri=$1 local ref=$2