-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from zscaler/zpa-#46-integration-tests
feat: Added initial zpa integration tests
- Loading branch information
Showing
145 changed files
with
3,404 additions
and
4,749 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[flake8] | ||
max-line-length = 127 | ||
max-doc-length = 127 | ||
extend_ignore = E203, W503, W605, F841, C901 | ||
extend_ignore = E203, W503, W605, F841, C901, E721 | ||
exclude = build,dist,.git,docs,docsrc,examples,.venv,venv |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_BASE="$(cd "$( dirname "$0")" && pwd )" | ||
ROOT=${SCRIPT_BASE}/.. | ||
|
||
# Exit immediatly if any command exits with a non-zero status | ||
set -e | ||
|
||
# Usage | ||
print_usage() { | ||
echo "Set the app/add-on version" | ||
echo "" | ||
echo "Usage:" | ||
echo " set-version.sh <new-version>" | ||
echo "" | ||
} | ||
|
||
# if less than one arguments supplied, display usage | ||
if [ $# -lt 1 ] | ||
then | ||
print_usage | ||
exit 1 | ||
fi | ||
|
||
# check whether user had supplied -h or --help . If yes display usage | ||
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then | ||
print_usage | ||
exit 0 | ||
fi | ||
|
||
NEW_VERSION=$(echo "$1" | sed -e 's/-beta\./.b/' | sed -e 's/-alpha\./.a/') | ||
|
||
# Set version in pyproject.toml | ||
grep -E '^version = ".+"$' "$ROOT/pyproject.toml" >/dev/null | ||
sed -i.bak -E "s/^version = \".+\"$/version = \"$NEW_VERSION\"/" "$ROOT/pyproject.toml" && rm "$ROOT/pyproject.toml.bak" | ||
|
||
# Set version in __init__.py | ||
grep -E '^__version__ = ".+"$' "$ROOT/zscaler/__init__.py" >/dev/null | ||
sed -i.bak -E "s/^__version__ = \".+\"$/__version__ = \"$NEW_VERSION\"/" "$ROOT/zscaler/__init__.py" && rm "$ROOT/zscaler/__init__.py.bak" | ||
|
||
# Generate setup.py from pyproject.toml | ||
make sync-deps |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: ZPA Test | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
merge_group: | ||
types: [checks_requested] | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 14 * * 1-5' # UTC | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
zpa-qa1-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZPA_QA_TENANT01 | ||
- ZPA_QA_TENANT02 | ||
environment: ${{ matrix.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
make lint | ||
- name: Run Pytest | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 20 | ||
command: | | ||
make test:integration:zpa | ||
env: | ||
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} | ||
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }} | ||
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }} | ||
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} | ||
ZPA_SDK_TEST_SWEEP: ${{ secrets.ZPA_SDK_TEST_SWEEP }} | ||
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }} | ||
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }} | ||
|
||
zpa-qa2-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZPA_QA2_TENANT01 | ||
environment: ${{ matrix.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 zscaler/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 zscaler/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Run Pytest | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 20 | ||
command: | | ||
make test:integration:zpa | ||
env: | ||
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} | ||
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }} | ||
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }} | ||
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} | ||
ZPA_SDK_TEST_SWEEP: ${{ secrets.ZPA_SDK_TEST_SWEEP }} | ||
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }} | ||
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }} | ||
|
||
zpa-beta-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZPA_BETA_TENANT01 | ||
environment: ${{ matrix.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 zscaler/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 zscaler/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Run Pytest | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 20 | ||
command: | | ||
make test:integration:zpa | ||
env: | ||
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} | ||
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }} | ||
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }} | ||
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} | ||
ZPA_SDK_TEST_SWEEP: ${{ secrets.ZPA_SDK_TEST_SWEEP }} | ||
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }} | ||
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }} | ||
needs: | ||
- zpa-qa1-tenants | ||
- zpa-qa2-tenants | ||
|
||
zpa-prod-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZPA_PROD_TENANT01 | ||
environment: ${{ matrix.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 zscaler/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 zscaler/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Run Pytest | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 20 | ||
command: | | ||
make test:integration:zpa | ||
env: | ||
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} | ||
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }} | ||
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }} | ||
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} | ||
ZPA_SDK_TEST_SWEEP: ${{ secrets.ZPA_SDK_TEST_SWEEP }} | ||
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }} | ||
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }} | ||
needs: | ||
- zpa-qa1-tenants | ||
- zpa-qa2-tenants | ||
- zpa-beta-tenants | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"preset": "conventionalcommits", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "poetry run .github/set-version.sh ${nextRelease.version}", | ||
"publishCmd": "poetry publish --build" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"setup.py", | ||
"README.rst", | ||
"zscaler/__init__.py" | ||
], | ||
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"successComment": ":tada: This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\n\nThe release is available on [PyPI](https://pypi.org/project/zscaler-sdk-python/) and [GitHub release](<github_release_url>)\n\n> Posted by [semantic-release](https://github.com/semantic-release/semantic-release) bot" | ||
} | ||
] | ||
] | ||
} |
Oops, something went wrong.