Skip to content

Commit 15c26bc

Browse files
authored
fix(general): fix integration tests (bridgecrewio#6207)
* fix integration tests * . * ? * .
1 parent b889ad5 commit 15c26bc

File tree

2 files changed

+149
-4
lines changed

2 files changed

+149
-4
lines changed

.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[flake8]
44
max-line-length = 120
55
# E203,E501 don't work with black together
6-
ignore = E203,E501,E731,W503,W504,DUO107,DUO104,DUO130,DUO109,DUO116,B028,B950,TC001,TC003,TC006,B907,B038
6+
ignore = E203,E501,E731,W503,W504,DUO107,DUO104,DUO130,DUO109,DUO116,B028,B950,TC001,TC003,TC006,B907,B038,B909
77
select = C,E,F,W,B,B9,A,TC
88
extend-exclude = .github, .pytest_cache, docs/*, venv/*, tests/*, flake8_plugins/*, cdk_integration_tests/src/python/*
99

.github/workflows/pr-test.yml

+148-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
strategy:
116116
fail-fast: true
117117
matrix:
118-
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
118+
python: ["3.10", "3.11", "3.12"]
119119
os: [ubuntu-latest, macos-latest, windows-latest]
120120
runs-on: ${{ matrix.os }}
121121
steps:
@@ -166,11 +166,66 @@ jobs:
166166
run: |
167167
pipenv run pytest integration_tests -k 'not api_key'
168168
169+
integration-tests-old-python:
170+
strategy:
171+
fail-fast: true
172+
matrix:
173+
python: ["3.8", "3.9"]
174+
os: [ubuntu-latest, macos-12, windows-latest]
175+
runs-on: ${{ matrix.os }}
176+
steps:
177+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
178+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v4
179+
with:
180+
python-version: ${{ matrix.python }}
181+
allow-prereleases: true
182+
cache: "pipenv"
183+
cache-dependency-path: "Pipfile.lock"
184+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4
185+
- uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
186+
with:
187+
token: ${{ secrets.GITHUB_TOKEN }}
188+
- uses: imranismail/setup-kustomize@a76db1c6419124d51470b1e388c4b29476f495f1 # v2
189+
if: ${{ runner.os != 'windows' }}
190+
with:
191+
github-token: ${{ secrets.GITHUB_TOKEN }}
192+
- name: Install pipenv
193+
run: |
194+
python -m pip install --no-cache-dir --upgrade pipenv
195+
- name: Build & install checkov package
196+
shell: bash
197+
run: |
198+
# remove venv, if exists
199+
pipenv --rm || true
200+
pipenv --python ${{ matrix.python }}
201+
pipenv run pip install pytest pytest-xdist setuptools wheel
202+
pipenv run python setup.py sdist bdist_wheel
203+
bash -c 'pipenv run pip install dist/checkov-*.whl'
204+
- name: Clone Terragoat - vulnerable terraform
205+
run: git clone https://github.com/bridgecrewio/terragoat
206+
- name: Clone Cfngoat - vulnerable cloudformation
207+
run: git clone https://github.com/bridgecrewio/cfngoat
208+
- name: Clone Kubernetes-goat - vulnerable kubernetes
209+
run: git clone https://github.com/madhuakula/kubernetes-goat
210+
- name: Clone kustomize-goat - vulnerable kustomize
211+
run: git clone https://github.com/bridgecrewio/kustomizegoat
212+
- name: Create checkov reports
213+
env:
214+
LOG_LEVEL: INFO
215+
BC_KEY: ${{ secrets.PRISMA_KEY_API2 }}
216+
PRISMA_API_URL: ${{ secrets.PRISMA_API_URL_2 }}
217+
run: |
218+
# Just making sure the API key tests don't run on PRs
219+
bash -c './integration_tests/prepare_data.sh ${{ matrix.os }} 3.8'
220+
- name: Run integration tests
221+
run: |
222+
pipenv run pytest integration_tests -k 'not api_key'
223+
169224
sast-integration-tests:
170225
strategy:
171226
fail-fast: true
172227
matrix:
173-
python: ["3.8", "3.12"]
228+
python: ["3.12"]
174229
os: [ubuntu-latest, macos-latest]
175230
runs-on: ${{ matrix.os }}
176231
steps:
@@ -214,11 +269,59 @@ jobs:
214269
run: |
215270
pipenv run pytest sast_integration_tests
216271
272+
sast-integration-tests-old-python:
273+
strategy:
274+
fail-fast: true
275+
matrix:
276+
python: ["3.8"]
277+
os: [ubuntu-latest, macos-12]
278+
runs-on: ${{ matrix.os }}
279+
steps:
280+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
281+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v4
282+
with:
283+
python-version: ${{ matrix.python }}
284+
allow-prereleases: true
285+
cache: "pipenv"
286+
cache-dependency-path: "Pipfile.lock"
287+
- name: Install pipenv
288+
run: |
289+
python -m pip install --no-cache-dir --upgrade pipenv
290+
- name: Build & install checkov package
291+
run: |
292+
# remove venv, if exists
293+
pipenv --rm || true
294+
pipenv --python ${{ matrix.python }}
295+
pipenv run pip install pytest pytest-xdist setuptools wheel
296+
pipenv run python setup.py sdist bdist_wheel
297+
bash -c 'pipenv run pip install dist/checkov-*.whl'
298+
- name: Clone flask - Python repo for SAST
299+
run: git clone https://github.com/pallets/flask
300+
- name: Clone WebGoat - Java repo for SAST
301+
run: git clone https://github.com/WebGoat/WebGoat
302+
- name: Clone axios - JavaScript repo for SAST
303+
run: git clone https://github.com/axios/axios
304+
- name: Create checkov reports
305+
env:
306+
LOG_LEVEL: INFO
307+
BC_API_KEY: ${{ secrets.PRISMA_KEY_API2 }}
308+
PRISMA_API_URL: ${{ secrets.PRISMA_API_URL_2 }}
309+
if: env.BC_API_KEY != null
310+
run: bash -c './sast_integration_tests/prepare_data.sh'
311+
- name: Run integration tests
312+
env:
313+
LOG_LEVEL: INFO
314+
BC_API_KEY: ${{ secrets.PRISMA_KEY_API2 }}
315+
PRISMA_API_URL: ${{ secrets.PRISMA_API_URL_2 }}
316+
if: env.BC_API_KEY != null
317+
run: |
318+
pipenv run pytest sast_integration_tests
319+
217320
cdk-integration-tests:
218321
strategy:
219322
fail-fast: true
220323
matrix:
221-
python: ["3.8", "3.12"]
324+
python: ["3.12"]
222325
os: [ubuntu-latest, macos-latest]
223326
runs-on: ${{ matrix.os }}
224327
steps:
@@ -256,6 +359,48 @@ jobs:
256359
run: |
257360
pipenv run pytest cdk_integration_tests
258361
362+
cdk-integration-tests-old-python:
363+
strategy:
364+
fail-fast: true
365+
matrix:
366+
python: ["3.8"]
367+
os: [ubuntu-latest, macos-12]
368+
runs-on: ${{ matrix.os }}
369+
steps:
370+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
371+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v4
372+
with:
373+
python-version: ${{ matrix.python }}
374+
allow-prereleases: true
375+
cache: "pipenv"
376+
cache-dependency-path: "Pipfile.lock"
377+
- name: Install pipenv
378+
run: |
379+
python -m pip install --no-cache-dir --upgrade pipenv
380+
- name: Build & install checkov package
381+
run: |
382+
# remove venv, if exists
383+
pipenv --rm || true
384+
pipenv --python ${{ matrix.python }}
385+
pipenv run pip install pytest pytest-xdist setuptools wheel
386+
pipenv run python setup.py sdist bdist_wheel
387+
bash -c 'pipenv run pip install dist/checkov-*.whl'
388+
- name: Create checkov reports
389+
env:
390+
LOG_LEVEL: INFO
391+
BC_API_KEY: ${{ secrets.PRISMA_KEY_API2 }}
392+
PRISMA_API_URL: ${{ secrets.PRISMA_API_URL_2 }}
393+
if: env.BC_API_KEY != null
394+
run: bash -c './cdk_integration_tests/prepare_data.sh'
395+
- name: Run integration tests
396+
env:
397+
LOG_LEVEL: INFO
398+
BC_API_KEY: ${{ secrets.PRISMA_KEY_API2 }}
399+
PRISMA_API_URL: ${{ secrets.PRISMA_API_URL_2 }}
400+
if: env.BC_API_KEY != null
401+
run: |
402+
pipenv run pytest cdk_integration_tests
403+
259404
performance-tests:
260405
env:
261406
PYTHON_VERSION: "3.8"

0 commit comments

Comments
 (0)