Skip to content

Commit

Permalink
add test for ordering of commits when using path filter and ci-skip
Browse files Browse the repository at this point in the history
disabled

Signed-off-by: Hoogervorst <[email protected]>
  • Loading branch information
Hoogervorst committed Oct 3, 2019
1 parent 07fcec0 commit de536c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .)},
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de536c6

Please sign in to comment.