Skip to content

Commit d473db0

Browse files
committed
Add tests for wrapper-validation with insufficient wrappers
- Test min-wrapper-count greater than wrappers - Test caswrapper-validation with insufficient wrappers
1 parent 833b05f commit d473db0

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/integ-test-wrapper-validation.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
with:
5555
# to allow the invalid wrapper jar present in test data
5656
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
57+
min-wrapper-count: 10
5758

5859
- name: Check outcome
5960
env:
@@ -98,3 +99,62 @@ jobs:
9899
echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS"
99100
exit 1
100101
fi
102+
103+
test-validation-minimum-wrapper-count:
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: Checkout sources
107+
uses: actions/checkout@v4
108+
- name: Initialize integ-test
109+
uses: ./.github/actions/init-integ-test
110+
111+
- name: Run wrapper-validation-action
112+
id: action-test
113+
uses: ./wrapper-validation
114+
with:
115+
# to allow the invalid wrapper jar present in test data
116+
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
117+
min-wrapper-count: 11
118+
# Expected to fail; validated below
119+
continue-on-error: true
120+
121+
- name: Check outcome
122+
env:
123+
# Evaluate workflow expressions here as env variable values instead of inside shell script
124+
# below to not accidentally inject code into shell script or break its syntax
125+
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
126+
run: |
127+
if [ "$VALIDATION_FAILED" != "true" ] ; then
128+
echo "Expected validation to fail, but it didn't"
129+
exit 1
130+
fi
131+
132+
test-validation-zero-wrappers:
133+
runs-on: ubuntu-latest
134+
steps:
135+
- name: Checkout sources
136+
uses: actions/checkout@v4 # Checkout the repository with no wrappers
137+
with:
138+
sparse-checkout: |
139+
.github/actions
140+
dist
141+
wrapper-validation
142+
- name: Initialize integ-test
143+
uses: ./.github/actions/init-integ-test
144+
145+
- name: Run wrapper-validation-action
146+
id: action-test
147+
uses: ./wrapper-validation
148+
# Expected to fail; validated below
149+
continue-on-error: true
150+
151+
- name: Check outcome
152+
env:
153+
# Evaluate workflow expressions here as env variable values instead of inside shell script
154+
# below to not accidentally inject code into shell script or break its syntax
155+
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
156+
run: |
157+
if [ "$VALIDATION_FAILED" != "true" ] ; then
158+
echo "Expected validation to fail, but it didn't"
159+
exit 1
160+
fi

0 commit comments

Comments
 (0)