Skip to content

Commit de536c6

Browse files
author
Hoogervorst
committed
add test for ordering of commits when using path filter and ci-skip
disabled Signed-off-by: Hoogervorst <cliff.hoogervorst@nn-group.com>
1 parent 07fcec0 commit de536c6

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

test/check.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ it_can_check_from_a_ref() {
105105
local ref1=$(make_commit $repo)
106106
local ref2=$(make_commit $repo)
107107
local ref3=$(make_commit $repo)
108-
check_uri_from $repo $ref1
109108
check_uri_from $repo $ref1 | jq -e "
110109
. == [
111110
{ref: $(echo $ref1 | jq -R .)},
@@ -263,6 +262,20 @@ it_checks_given_paths() {
263262
"
264263
}
265264

265+
it_checks_given_paths_ci_skip_disabled() {
266+
local repo=$(init_repo)
267+
local ref1=$(make_commit_to_file $repo file-a)
268+
local ref2=$(make_commit_to_file $repo file-a)
269+
local ref3=$(make_commit_to_file $repo file-a)
270+
check_uri_from_paths_disable_ci_skip $repo $ref1 "file-a" | jq -e "
271+
. == [
272+
{ref: $(echo $ref1 | jq -R .)},
273+
{ref: $(echo $ref2 | jq -R .)},
274+
{ref: $(echo $ref3 | jq -R .)}
275+
]
276+
"
277+
}
278+
266279
it_checks_given_paths_on_branch() {
267280
local repo=$(init_repo)
268281
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
673686
run it_can_check_from_a_bogus_sha
674687
run it_skips_ignored_paths
675688
run it_checks_given_paths
689+
run it_checks_given_paths_ci_skip_disabled
676690
run it_checks_given_paths_on_branch
677691
run it_checks_given_glob_paths
678692
run it_checks_given_ignored_paths

test/helpers.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,24 @@ check_uri_from_ignoring() {
363363
}" | ${resource_dir}/check | tee /dev/stderr
364364
}
365365

366+
check_uri_from_paths_disable_ci_skip() {
367+
local uri=$1
368+
local ref=$2
369+
370+
shift 2
371+
372+
jq -n "{
373+
source: {
374+
uri: $(echo $uri | jq -R .),
375+
paths: $(echo "$@" | jq -R '. | split(" ")'),
376+
disable_ci_skip: true
377+
},
378+
version: {
379+
ref: $(echo $ref | jq -R .)
380+
}
381+
}" | ${resource_dir}/check | tee /dev/stderr
382+
}
383+
366384
check_uri_from_paths() {
367385
local uri=$1
368386
local ref=$2

0 commit comments

Comments
 (0)