Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
538 lines (431 loc) · 23.5 KB
/
Copy pathMakefile
File metadata and controls
538 lines (431 loc) · 23.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
COLOR_OK=\\x1b[0;32m
COLOR_NONE=\x1b[0m
COLOR_ERROR=\x1b[31;01m
COLOR_WARNING=\x1b[33;01m
COLOR_ZSCALER=\x1B[34;01m
VERSION=$(shell grep -E -o '(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?' ./zscaler/__init__.py)
help:
@echo "$(COLOR_ZSCALER)"
@echo " ______ _ "
@echo " |___ / | | "
@echo " / / ___ ___ __ _| | ___ _ __ "
@echo " / / / __|/ __/ _\` | |/ _ \ '__|"
@echo " / /__\__ \ (_| (_| | | __/ | "
@echo " /_____|___/\___\__,_|_|\___|_| "
@echo " "
@echo " "
@echo "$(COLOR_NONE)"
@echo "$(COLOR_OK)Zscaler SDK Python$(COLOR_NONE) version $(COLOR_WARNING)$(VERSION)$(COLOR_NONE)"
@echo ""
@echo "$(COLOR_WARNING)Usage:$(COLOR_NONE)"
@echo "$(COLOR_OK) make [command]$(COLOR_NONE)"
@echo ""
@echo "$(COLOR_WARNING)Available commands:$(COLOR_NONE)"
@echo "$(COLOR_OK) help$(COLOR_NONE) Show this help message"
@echo "$(COLOR_WARNING)clean$(COLOR_NONE)"
@echo "$(COLOR_OK) clean Remove all build, test, coverage and Python artifacts$(COLOR_NONE)"
@echo "$(COLOR_OK) clean-build Remove build artifacts$(COLOR_NONE)"
@echo "$(COLOR_OK) clean-pyc Remove Python file artifacts$(COLOR_NONE)"
@echo "$(COLOR_OK) clean-test Remove test and coverage artifacts$(COLOR_NONE)"
@echo "$(COLOR_WARNING)development$(COLOR_NONE)"
@echo "$(COLOR_OK) check-format Check code format/style with black$(COLOR_NONE)"
@echo "$(COLOR_OK) format Reformat code with black$(COLOR_NONE)"
@echo "$(COLOR_OK) lint Check style with ruff for all packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zcc Check style with ruff for zcc packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:ztw Check style with ruff for ztw packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zdx Check style with ruff for zdx packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zpa Check style with ruff for zpa packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zia Check style with ruff for zia packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zid Check style with ruff for zid packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zins Check style with ruff for zins packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zms Check style with ruff for zms packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zbi Check style with ruff for zbi packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:aiguard Check style with ruff for aiguard packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:ztb Check style with ruff for ztb packages$(COLOR_NONE)"
@echo "$(COLOR_OK) lint:zwa Check style with ruff for zwa packages$(COLOR_NONE)"
@echo "$(COLOR_OK) coverage Check code coverage quickly with the default Python$(COLOR_NONE)"
@echo "$(COLOR_WARNING)codegen (python_model_generation/)$(COLOR_NONE)"
@echo "$(COLOR_OK) manifests PRODUCT=zpa List a spec's controllers (add SECTION=\"...\" to generate manifests+payloads)$(COLOR_NONE)"
@echo "$(COLOR_OK) generate PRODUCT=zia Generate models + API clients for a product (into generated_*/)$(COLOR_NONE)"
@echo "$(COLOR_OK) generate:models PRODUCT=zia Generate only models from json_payloads/$(COLOR_NONE)"
@echo "$(COLOR_OK) generate:clients PRODUCT=zia Generate only API clients from api_manifests/$(COLOR_NONE)"
@echo "$(COLOR_OK) generate:tests PRODUCT=zia Generate only VCR integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) promote PRODUCT=zia Promote generated files into zscaler/ + wire *_service.py$(COLOR_NONE)"
@echo "$(COLOR_OK) promote:dry PRODUCT=zia Preview promotion without writing anything$(COLOR_NONE)"
@echo "$(COLOR_WARNING)test$(COLOR_NONE)"
@echo "$(COLOR_OK) test:all Run all tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:unit Run only unit tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:unit:coverage Run unit tests with coverage report$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zcc Run only zcc integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:ztw Run only ztw integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zdx Run only zdx integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zia Run only zia integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zpa Run only zpa integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zins Run only zins integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zms Run only zms integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:zbi Run only zbi integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:ztb Run only ztb integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:integration:aiguard Run only aiguard integration tests$(COLOR_NONE)"
@echo "$(COLOR_OK) test:vcr:record:aiguard Record aiguard VCR cassettes against a live tenant$(COLOR_NONE)"
@echo "$(COLOR_OK) test:vcr:playback:aiguard Replay aiguard VCR cassettes (no credentials needed)$(COLOR_NONE)"
@echo "$(COLOR_OK) coverage:aiguard Coverage report for the aiguard package$(COLOR_NONE)"
@echo "$(COLOR_OK) sweep:aiguard Delete leftover aiguard tests- resources$(COLOR_NONE)"
@echo "$(COLOR_WARNING)security$(COLOR_NONE)"
@echo "$(COLOR_OK) security-scan Run Trivy (vuln + secret scan, excludes local_dev/openapi)$(COLOR_NONE)"
@echo "$(COLOR_WARNING)build$(COLOR_NONE)"
@echo "$(COLOR_OK) build:dist Build the distribution for publishing$(COLOR_NONE)"
@echo "$(COLOR_WARNING)publish$(COLOR_NONE)"
@echo "$(COLOR_OK) publish:test Publish distribution to testpypi (Will ask for credentials)$(COLOR_NONE)"
@echo "$(COLOR_OK) publish:prod Publish distribution to pypi (Will ask for credentials)$(COLOR_NONE)"
clean: clean-build clean-pyc clean-test clean-docsrc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-docs:
rm -fr docs/_build/
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
clean-docsrc:
rm -fr docsrc/_build/
docs: clean-docsrc
$(MAKE) -C docsrc html
open docsrc/_build/html/index.html
lint:
poetry run ruff check . --select I
poetry run ruff check .
lint\:zcc:
poetry run ruff check zscaler/zcc --select I
poetry run ruff check zscaler/zcc
lint\:ztw:
poetry run ruff check zscaler/ztw --select I
poetry run ruff check zscaler/ztw
lint\:zdx:
poetry run ruff check zscaler/zdx --select I
poetry run ruff check zscaler/zdx
lint\:zpa:
poetry run ruff check zscaler/zpa --select I
poetry run ruff check zscaler/zpa
lint\:zia:
poetry run ruff check zscaler/zia --select I
poetry run ruff check zscaler/zia
lint\:zid:
poetry run ruff check zscaler/zid --select I
poetry run ruff check zscaler/zid
lint\:zins:
poetry run ruff check zscaler/zins --select I
poetry run ruff check zscaler/zins
lint\:zms:
poetry run ruff check zscaler/zms --select I
poetry run ruff check zscaler/zms
lint\:zbi:
poetry run ruff check zscaler/zbi --select I
poetry run ruff check zscaler/zbi
lint\:zwa:
poetry run ruff check zscaler/zwa --select I
poetry run ruff check zscaler/zwa
lint\:zeasm:
poetry run ruff check zscaler/zeasm --select I
poetry run ruff check zscaler/zeasm
lint\:aiguard:
poetry run ruff check zscaler/aiguard --select I
poetry run ruff check zscaler/aiguard
format:
poetry run black .
check-format:
poetry run black --check --diff .
# ---------------------------------------------------------------------------
# Code generation (python_model_generation/)
# generate -> json_payloads/ + api_manifests/ into generated_*/ (review)
# promote -> generated_*/ into zscaler/<product>/ (+ *_service.py wiring)
# All require PRODUCT, e.g. make generate PRODUCT=zia
# ---------------------------------------------------------------------------
GEN_DIR=python_model_generation
_require-product:
@if [ -z "$(PRODUCT)" ]; then \
echo "$(COLOR_ERROR)PRODUCT is required, e.g. make generate PRODUCT=zia$(COLOR_NONE)"; \
exit 1; \
fi
# Derive manifests + payloads from a product's OpenAPI spec (ZPA today).
# make manifests PRODUCT=zpa -> list controllers
# make manifests PRODUCT=zpa SECTION="Policy Group"
manifests: _require-product
@if [ -z "$(SECTION)" ]; then \
poetry run python $(GEN_DIR)/generate_manifests.py --product $(PRODUCT) --list; \
else \
poetry run python $(GEN_DIR)/generate_manifests.py --product $(PRODUCT) --section "$(SECTION)"; \
fi
generate\:models: _require-product
poetry run python $(GEN_DIR)/generate_models.py --product $(PRODUCT)
generate\:clients: _require-product
poetry run python $(GEN_DIR)/generate_api_client.py --product $(PRODUCT)
generate\:tests: _require-product
poetry run python $(GEN_DIR)/generate_tests.py --product $(PRODUCT)
generate: _require-product
poetry run python $(GEN_DIR)/generate_models.py --product $(PRODUCT)
poetry run python $(GEN_DIR)/generate_api_client.py --product $(PRODUCT)
poetry run python $(GEN_DIR)/generate_tests.py --product $(PRODUCT)
promote: _require-product
poetry run python $(GEN_DIR)/promote.py --product $(PRODUCT) --all
promote\:dry: _require-product
poetry run python $(GEN_DIR)/promote.py --product $(PRODUCT) --all --dry-run
test\:unit:
@echo "$(COLOR_ZSCALER)Running unit tests...$(COLOR_NONE)"
poetry run pytest tests/unit --disable-warnings -v
test\:unit\:coverage:
@echo "$(COLOR_ZSCALER)Running unit tests with coverage...$(COLOR_NONE)"
poetry run pytest tests/unit --cov=zscaler --cov-report xml --cov-report term --junitxml=junit.xml -o junit_family=legacy --disable-warnings -v
test\:integration\:zcc:
@echo "$(COLOR_ZSCALER)Running zcc integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zcc --disable-warnings
test\:integration\:ztw:
@echo "$(COLOR_ZSCALER)Running ztw integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/ztw --disable-warnings
test\:integration\:zdx:
@echo "$(COLOR_ZSCALER)Running zdx integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zdx --disable-warnings
test\:integration\:zpa:
@echo "$(COLOR_ZSCALER)Running zpa integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zpa --disable-warnings
test\:integration\:zia:
@echo "$(COLOR_ZSCALER)Running zia integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zia --disable-warnings
test\:integration\:zid:
@echo "$(COLOR_ZSCALER)Running zid integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zid --disable-warnings
test\:integration\:zins:
@echo "$(COLOR_ZSCALER)Running zins integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zins --disable-warnings
test\:integration\:aiguard:
@echo "$(COLOR_ZSCALER)Running aiguard integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/aiguard --disable-warnings
test\:integration\:zms:
@echo "$(COLOR_ZSCALER)Running zms integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zms --disable-warnings
test\:integration\:zbi:
@echo "$(COLOR_ZSCALER)Running zbi integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zbi --disable-warnings
test\:integration\:zwa:
@echo "$(COLOR_ZSCALER)Running zwa integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zwa --disable-warnings
test\:integration\:zeasm:
@echo "$(COLOR_ZSCALER)Running zeasm integration tests...$(COLOR_NONE)"
poetry run pytest tests/integration/zeasm --disable-warnings
test-simple:
poetry run pytest --disable-warnings
security-scan:
@echo "$(COLOR_ZSCALER)Running Trivy security scan (vuln + secret)...$(COLOR_NONE)"
trivy fs . --scanners vuln,secret --skip-version-check
coverage:
poetry run pytest --cov=zscaler --cov-report xml --cov-report term
coverage\:zcc:
poetry run pytest tests/integration/zcc -v --cov=zscaler/zcc --cov-report xml --cov-report term
coverage\:ztw:
poetry run pytest tests/integration/ztw -v --cov=zscaler/ztw --cov-report xml --cov-report term
coverage\:zdx:
poetry run pytest tests/integration/zdx -v --cov=zscaler/zdx --cov-report xml --cov-report term
coverage\:zia:
poetry run pytest tests/integration/zia --cov=zscaler/zia --cov-report xml --cov-report term
coverage\:zpa:
poetry run pytest tests/integration/zpa --cov=zscaler/zpa --cov-report xml --cov-report term
coverage\:zid:
poetry run pytest tests/integration/zid --cov=zscaler/zid --cov-report xml --cov-report term
coverage\:zins:
poetry run pytest tests/integration/zins --cov=zscaler/zins --cov-report xml --cov-report term
coverage\:zms:
poetry run pytest tests/integration/zms --cov=zscaler/zms --cov-report xml --cov-report term
coverage\:zbi:
poetry run pytest tests/integration/zbi --cov=zscaler/zbi --cov-report xml --cov-report term
coverage\:zeasm:
poetry run pytest tests/integration/zeasm --cov=zscaler/zeasm --cov-report xml --cov-report term
coverage\:aiguard:
poetry run pytest tests/integration/aiguard --cov=zscaler/aiguard --cov-report xml --cov-report term
# ==========================================
# VCR Testing Commands
# ==========================================
# Note: For recording, export credentials first:
# export ZSCALER_CLIENT_ID="your_id"
# export ZSCALER_CLIENT_SECRET="your_secret"
# export ZSCALER_VANITY_DOMAIN="your_domain"
# export ZPA_CUSTOMER_ID="your_customer_id"
# export ZSCALER_CLOUD="production"
# ==========================================
# Run all tests with VCR cassettes (no credentials needed)
test\:vcr:
@echo "$(COLOR_ZSCALER)Running tests with VCR cassettes (no credentials needed)...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/ -v --disable-warnings
# Run integration tests with VCR cassettes
test\:integration\:vcr:
@echo "$(COLOR_ZSCALER)Running integration tests with VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration -v --disable-warnings
# Run integration tests with VCR and coverage
test\:integration\:vcr\:coverage:
@echo "$(COLOR_ZSCALER)Running integration tests with VCR cassettes and coverage...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration --cov=zscaler --cov-report xml --cov-report term --disable-warnings -v
# Record new VCR cassettes for all integration tests (requires credentials)
test\:vcr\:record:
@echo "$(COLOR_WARNING)Recording VCR cassettes (requires credentials)...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZIA
test\:vcr\:record\:zia:
@echo "$(COLOR_ZSCALER)Recording ZIA VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zia --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZPA
test\:vcr\:record\:zpa:
@echo "$(COLOR_ZSCALER)Recording ZPA VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zpa --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZCC
test\:vcr\:record\:zcc:
@echo "$(COLOR_ZSCALER)Recording ZCC VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zcc --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZDX
test\:vcr\:record\:zdx:
@echo "$(COLOR_ZSCALER)Recording ZDX VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zdx --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for Zid
test\:vcr\:record\:zid:
@echo "$(COLOR_ZSCALER)Recording Zid VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zid --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for Z-Insights (zins)
test\:vcr\:record\:zins:
@echo "$(COLOR_ZSCALER)Recording Z-Insights (zins) VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zins --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZMS
test\:vcr\:record\:zms:
@echo "$(COLOR_ZSCALER)Recording ZMS VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zms --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZBI
test\:vcr\:record\:zbi:
@echo "$(COLOR_ZSCALER)Recording ZBI VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zbi --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZTW
test\:vcr\:record\:ztw:
@echo "$(COLOR_ZSCALER)Recording ZTW VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/ztw --record-mode=rewrite -v --disable-warnings
# Record VCR cassettes for ZEASM
# Record VCR cassettes for AI Guard
# tests/conftest.py's vcr_config pins record_mode to "new_episodes" when MOCK_TESTS=false,
# which overrides --record-mode=rewrite. Combined with match_on=[method, path, query] that
# replays a previously recorded response for the same endpoint even when the request body
# has changed, so stale cassettes are removed first to force a genuine re-record.
test\:vcr\:record\:aiguard:
@echo "$(COLOR_ZSCALER)Recording AI Guard VCR cassettes...$(COLOR_NONE)"
find tests/integration/aiguard/cassettes -name '*.yaml' -delete
MOCK_TESTS=false poetry run pytest tests/integration/aiguard --record-mode=rewrite -v --disable-warnings
test\:vcr\:record\:zeasm:
@echo "$(COLOR_ZSCALER)Recording ZEASM VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration/zeasm --record-mode=rewrite -v --disable-warnings
# Playback VCR cassettes for ZIA (no credentials needed)
# Playback VCR cassettes for AI Guard (no credentials needed)
test\:vcr\:playback\:aiguard:
@echo "$(COLOR_ZSCALER)Playing back AI Guard VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/aiguard -v --disable-warnings
test\:vcr\:playback\:zia:
@echo "$(COLOR_ZSCALER)Playing back ZIA VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zia -v --disable-warnings
# Playback VCR cassettes for ZPA (no credentials needed)
test\:vcr\:playback\:zpa:
@echo "$(COLOR_ZSCALER)Playing back ZPA VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zpa -v --disable-warnings
# Playback VCR cassettes for ZCC (no credentials needed)
test\:vcr\:playback\:zcc:
@echo "$(COLOR_ZSCALER)Playing back ZCC VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zcc -v --disable-warnings
# Playback VCR cassettes for ZDX (no credentials needed)
test\:vcr\:playback\:zdx:
@echo "$(COLOR_ZSCALER)Playing back ZDX VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zdx -v --disable-warnings
# Playback VCR cassettes for Zid (no credentials needed)
test\:vcr\:playback\:zid:
@echo "$(COLOR_ZSCALER)Playing back Zid VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zid -v --disable-warnings
# Playback VCR cassettes for Z-Insights (zins) (no credentials needed)
test\:vcr\:playback\:zins:
@echo "$(COLOR_ZSCALER)Playing back Z-Insights (zins) VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zins -v --disable-warnings
# Playback VCR cassettes for ZMS (no credentials needed)
test\:vcr\:playback\:zms:
@echo "$(COLOR_ZSCALER)Playing back ZMS VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zms -v --disable-warnings
# Playback VCR cassettes for ZBI (no credentials needed)
test\:vcr\:playback\:zbi:
@echo "$(COLOR_ZSCALER)Playing back ZBI VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zbi -v --disable-warnings
# Playback VCR cassettes for ZTW (no credentials needed)
test\:vcr\:playback\:ztw:
@echo "$(COLOR_ZSCALER)Playing back ZTW VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/ztw -v --disable-warnings
# Playback VCR cassettes for ZEASM (no credentials needed)
test\:vcr\:playback\:zeasm:
@echo "$(COLOR_ZSCALER)Playing back ZEASM VCR cassettes...$(COLOR_NONE)"
MOCK_TESTS=true poetry run pytest tests/integration/zeasm -v --disable-warnings
# Run integration tests against live API (no VCR)
test\:integration\:live:
@echo "$(COLOR_WARNING)Running LIVE integration tests (requires credentials)...$(COLOR_NONE)"
MOCK_TESTS=false poetry run pytest tests/integration --record-mode=none -v --disable-warnings
# ==========================================
# Sweep Commands
# ==========================================
sweep\:zia:
@echo "$(COLOR_WARNING)WARNING: This will destroy infrastructure. Use only in development accounts.$(COLOR_NONE)"
ZIA_SDK_TEST_SWEEP=true poetry run python tests/integration/zia/sweep/run_sweep.py --sweep
sweep\:zpa:
@echo "$(COLOR_WARNING)WARNING: This will destroy infrastructure. Use only in development accounts.$(COLOR_NONE)"
ZPA_SDK_TEST_SWEEP=true poetry run python tests/integration/zpa/sweep/run_sweep.py --sweep
sweep\:zid:
@echo "$(COLOR_WARNING)WARNING: This will destroy infrastructure. Use only in development accounts.$(COLOR_NONE)"
ZIDENTITY_SDK_TEST_SWEEP=true poetry run python tests/integration/zid/sweep/run_sweep.py --sweep
sweep\:zins:
@echo "$(COLOR_WARNING)WARNING: This will destroy infrastructure. Use only in development accounts.$(COLOR_NONE)"
ZINS_SDK_TEST_SWEEP=true poetry run python tests/integration/zins/sweep/run_sweep.py --sweep
sweep\:aiguard:
@echo "$(COLOR_WARNING)WARNING: This will destroy infrastructure. Use only in development accounts.$(COLOR_NONE)"
AIGUARD_SDK_TEST_SWEEP=true poetry run python tests/integration/aiguard/sweep/run_sweep.py --sweep
build\:dist:
rm -rf dist build
poetry build
ls -l dist
publish\:test:
python3 -m twine upload --repository testpypi dist/*
publish\:prod:
python3 -m twine upload dist/*
# Runtime-only dependencies
sync-deps:
@poetry export --help >/dev/null 2>&1 || poetry self add poetry-plugin-export
poetry export -f requirements.txt --without-hashes > requirements.txt
# Dev dependencies for contributors/CI
sync-dev-deps:
@poetry export --help >/dev/null 2>&1 || poetry self add poetry-plugin-export
poetry export -f requirements.txt --without-hashes --with dev > requirements-dev.txt
local-setup:
ifeq ($(wildcard ~/.local/bin/poetry),)
@echo "installing poetry"
curl -sSL https://install.python-poetry.org | python3 -
else
@echo "poetry installation found"
endif
~/.local/bin/poetry install
# ==========================================
# Security Scanning
# ==========================================
# Scan VCR cassettes for secrets (default)
security\:scan:
@echo "$(COLOR_ZSCALER)Scanning for secrets in VCR cassettes...$(COLOR_NONE)"
./scripts/check-secrets.sh
# Scan entire repository for secrets
security\:scan\:full:
@echo "$(COLOR_ZSCALER)Scanning entire repository for secrets...$(COLOR_NONE)"
./scripts/check-secrets.sh --full
# Install secret detection tools
security\:install:
@echo "$(COLOR_ZSCALER)Installing secret detection tools...$(COLOR_NONE)"
./scripts/check-secrets.sh --install
.PHONY: clean-pyc clean-build docs clean _require-product manifests generate generate\:models generate\:clients generate\:tests promote promote\:dry