-
Notifications
You must be signed in to change notification settings - Fork 5
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 #51 from zscaler/zia-#51-integration-tests
feat: Added ZIA Integration tests
- Loading branch information
Showing
70 changed files
with
3,844 additions
and
5,514 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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# 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: ZIA 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: | ||
zia-beta-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZIA_ZSBETA | ||
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:zia | ||
- name: Run Pytest | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
timeout_minutes: 20 | ||
command: | | ||
make test:integration:zia | ||
env: | ||
ZIA_USERNAME: ${{ secrets.ZIA_USERNAME }} | ||
ZIA_PASSWORD: ${{ secrets.ZIA_PASSWORD }} | ||
ZIA_API_KEY: ${{ secrets.ZIA_API_KEY }} | ||
ZIA_CLOUD: ${{ secrets.ZIA_CLOUD }} | ||
ZIA_SANDBOX_TOKEN: ${{ secrets.ZIA_SANDBOX_TOKEN }} | ||
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 }} | ||
|
||
zia-test-tenants: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
environment: | ||
- ZIA_ZSCLOUD | ||
- ZIA_ZS0 | ||
- ZIA_ZS1 | ||
- ZIA_ZS2 | ||
- ZIA_ZS3 | ||
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:zia | ||
env: | ||
ZIA_USERNAME: ${{ secrets.ZIA_USERNAME }} | ||
ZIA_PASSWORD: ${{ secrets.ZIA_PASSWORD }} | ||
ZIA_API_KEY: ${{ secrets.ZIA_API_KEY }} | ||
ZIA_CLOUD: ${{ secrets.ZIA_CLOUD }} | ||
ZIA_SANDBOX_TOKEN: ${{ secrets.ZIA_SANDBOX_TOKEN }} | ||
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 }} |
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,20 @@ | ||
|
||
# Read the Docs configuration file for Sphinx projects | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS and Python version | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
|
||
# Build documentation in the "docsrc/" directory with Sphinx | ||
sphinx: | ||
configuration: docsrc/conf.py | ||
|
||
# pyZscaler doc build requirements | ||
python: | ||
install: | ||
- requirements: dev_requirements.txt |
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
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
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,52 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (c) 2023, Zscaler Inc. | ||
# | ||
# Permission to use, copy, modify, and/or distribute this software for any | ||
# purpose with or without fee is hereby granted, provided that the above | ||
# copyright notice and this permission notice appear in all copies. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
|
||
|
||
import pytest | ||
from tests.integration.zia.conftest import MockZIAClient | ||
|
||
@pytest.fixture | ||
def fs(): | ||
yield | ||
|
||
class TestActivation: | ||
""" | ||
Integration Tests for the ZIA Activation | ||
""" | ||
|
||
@pytest.mark.asyncio | ||
async def test_activation(self, fs): | ||
client = MockZIAClient(fs) | ||
errors = [] # Initialize an empty list to collect errors | ||
|
||
# Test Config Status | ||
try: | ||
config_status = client.activate.status() | ||
# Allow for both "ACTIVE" and "PENDING" statuses | ||
assert config_status in ["ACTIVE", "PENDING"], f"Unexpected configuration status: {config_status}" | ||
except Exception as exc: | ||
errors.append(f"Config status check failed: {exc}") | ||
|
||
# Test Config Activation | ||
try: | ||
config_activation = client.activate.activate() | ||
# Assuming the activation process might also return "PENDING" immediately after activation request | ||
assert config_activation in ["ACTIVE", "PENDING"], f"Unexpected configuration activation status: {config_activation}" | ||
except Exception as exc: | ||
errors.append(f"Config activation failed: {exc}") | ||
|
||
# Assert that no errors occurred during the test | ||
assert len(errors) == 0, f"Errors occurred during activation operations test: {errors}" |
Oops, something went wrong.