test: add test to cleanup the same resource twice (#7965) #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cli | |
permissions: {} | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'release*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cli-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Setup build env | |
uses: ./.github/actions/setup-build-env | |
with: | |
build-cache-key: cli-test | |
- name: Setup TEST_GIT_BRANCH | |
run: | | |
if [[ ${{ github.event_name }} == "push" ]] | |
then | |
echo "TEST_GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
elif [[ ${{ github.event_name }} == "pull_request" ]] | |
then | |
echo "TEST_GIT_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV | |
fi | |
- name: Test CLI | |
run: | | |
VERSION=${{ github.ref_name }} make test-cli | |
- name: Test CLI (failures) | |
run: | | |
CLI_PATH=$PWD/cmd/cli/kubectl-kyverno/kubectl-kyverno | |
$CLI_PATH test ./test/cli/test-fail/missing-policy && exit 1 || exit 0 | |
$CLI_PATH test ./test/cli/test-fail/missing-rule && exit 1 || exit 0 | |
$CLI_PATH test ./test/cli/test-fail/missing-resource && exit 1 || exit 0 |