Skip to content

Commit

Permalink
fix: update attributes and add integration tests
Browse files Browse the repository at this point in the history
Changed rules.names attribute within app protection custom control resource to optional.

Added zpa-test.yml for daily integration test execution.
  • Loading branch information
willguibr committed Apr 25, 2024
1 parent 269ba88 commit c4cb0cc
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python-version: ${{ matrix.python_ver }}

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9

# Install the head of the given branch (devel, stable-2.10)
- name: Install ansible-base (${{ matrix.ansible }})
Expand Down
140 changes: 140 additions & 0 deletions .github/workflows/zpa-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
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.10"]
environment:
- ZPA_QA_TENANT01
- ZPA_QA_TENANT02
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run 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 }}
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.10"]
environment:
- ZPA_BETA_TENANT01
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run 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 }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}



zpa-prod-tenants:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
environment:
- ZPA_BETA_TENANT01
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run 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 }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}
4 changes: 2 additions & 2 deletions plugins/modules/zpa_app_protection_custom_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
description: "The names of the AppProtection rule"
type: list
elements: str
required: true
required: false
type:
description: The type of the AppProtection rule.
required: false
Expand Down Expand Up @@ -490,7 +490,7 @@ def main():
rhs=dict(type="str", required=False),
),
),
names=dict(type="list", elements="str", required=True),
names=dict(type="list", elements="str", required=False),
type=dict(
type="str",
required=False,
Expand Down

0 comments on commit c4cb0cc

Please sign in to comment.