Skip to content

Commit c103904

Browse files
committed
reInvent 2025: CNS427 Sample application
1 parent 01e7592 commit c103904

File tree

96 files changed

+16977
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+16977
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cdk.out
2+
cdk-outputs.json
3+
.mypy_cache
4+
.ruff_cache
5+
.pytest_cache
6+
__pycache__
7+
.venv
8+
.git
9+
tests
10+
infrastructure
11+
docs
12+
scripts
13+
ai-dlc
14+
*.md
15+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.venv
2+
.coverage
3+
.coverage.*
4+
htmlcov/
5+
coverage.xml
6+
*.cover
7+
*cache
8+
.github
9+
__pycache__/
10+
junit.xml
11+
12+
# Python build artifacts
13+
*.egg-info/
14+
*.egg
15+
dist/
16+
build/
17+
18+
# CDK output
19+
cdk.out/
20+
cdk-outputs.json
21+
*.js
22+
*.d.ts
23+
node_modules/
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# CNS427 Task API - Makefile for test automation
2+
3+
.PHONY: help install test test-unit test-integration test-e2e test-all coverage lint format type-check cdk-nag cdk-nag-report check deploy deploy-test-infra destroy-test-infra check-test-infra clean
4+
5+
# Default target
6+
help:
7+
@echo "CNS427 Task API - Available Commands:"
8+
@echo ""
9+
@echo "Setup:"
10+
@echo " install Install dependencies with Poetry"
11+
@echo " validate-setup Validate EventBridge testing setup"
12+
@echo ""
13+
@echo "Testing:"
14+
@echo " test Run all available tests"
15+
@echo " test-unit Run unit tests only (fast, no AWS)"
16+
@echo " test-property Run property-based tests (Hypothesis, complex algorithms)"
17+
@echo " test-integration Run integration tests (includes EventBridge)"
18+
@echo " test-e2e Run end-to-end tests"
19+
@echo " test-all Run complete test suite"
20+
@echo " coverage Generate coverage report"
21+
@echo ""
22+
@echo "Test Infrastructure:"
23+
@echo " deploy-test-infra Deploy EventBridge test infrastructure"
24+
@echo " destroy-test-infra Destroy EventBridge test infrastructure"
25+
@echo " check-test-infra Check test infrastructure status"
26+
@echo ""
27+
@echo "Code Quality:"
28+
@echo " lint Run linting checks"
29+
@echo " format Format code with ruff"
30+
@echo " type-check Run type checking with mypy"
31+
@echo " cdk-nag Run CDK Nag security checks (blocks on violations)"
32+
@echo " cdk-nag-report Generate CDK Nag security report (non-blocking)"
33+
@echo " check Run all quality checks (lint + type-check + cdk-nag)"
34+
@echo ""
35+
@echo "Deployment:"
36+
@echo " deploy Deploy main application to AWS"
37+
@echo " destroy Destroy main application"
38+
@echo " clean Clean build artifacts"
39+
40+
# Setup
41+
install:
42+
@echo "Installing dependencies..."
43+
poetry install
44+
45+
validate-setup:
46+
@echo "Validating EventBridge testing setup..."
47+
poetry run validate-setup
48+
49+
# Testing targets
50+
test:
51+
@echo "Running all available tests..."
52+
poetry run test-all
53+
54+
test-unit:
55+
@echo "Running unit tests..."
56+
poetry run test-unit
57+
58+
test-property:
59+
@echo "Running property-based tests..."
60+
poetry run pytest tests/property_based/ -v
61+
62+
test-integration:
63+
@echo "Running integration tests (including EventBridge)..."
64+
poetry run test-integration
65+
66+
test-e2e:
67+
@echo "Running end-to-end tests..."
68+
poetry run test-e2e
69+
70+
test-all:
71+
@echo "Running complete test suite..."
72+
poetry run test-all
73+
74+
coverage:
75+
@echo "Generating coverage report..."
76+
poetry run pytest tests/ --cov=services --cov=shared --cov-report=html --cov-report=term
77+
@echo "Coverage report available at: htmlcov/index.html"
78+
79+
# Test Infrastructure Management
80+
deploy-test-infra:
81+
@echo "Deploying EventBridge test infrastructure..."
82+
cd infrastructure/test_harness && poetry run cdk deploy
83+
84+
destroy-test-infra:
85+
@echo "Destroying EventBridge test infrastructure..."
86+
cd infrastructure/test_harness && poetry run cdk destroy
87+
88+
check-test-infra:
89+
@echo "Checking test infrastructure status..."
90+
@aws dynamodb describe-table --table-name cns427-task-api-test-results > /dev/null 2>&1 && echo "✅ Test infrastructure is deployed" || echo "❌ Test infrastructure not found"
91+
92+
# Code quality
93+
lint:
94+
@echo "Running linting checks..."
95+
poetry run lint
96+
97+
format:
98+
@echo "Formatting code..."
99+
poetry run format
100+
101+
type-check:
102+
@echo "Running type checking..."
103+
poetry run type-check
104+
105+
cdk-nag:
106+
@echo "Running CDK Nag security checks..."
107+
@echo "This will fail if security violations are found."
108+
ENABLE_CDK_NAG=true poetry run cdk synth --quiet > /dev/null
109+
@echo "✅ CDK Nag checks passed - no security violations found"
110+
111+
cdk-nag-report:
112+
@echo "Generating CDK Nag security report..."
113+
ENABLE_CDK_NAG=true CDK_NAG_REPORT=true poetry run cdk synth --quiet > /dev/null
114+
@echo "✅ CDK Nag report generated"
115+
@echo "📊 Reports available at:"
116+
@echo " - cdk.out/AwsSolutions-cns427-task-api-core.csv"
117+
@echo " - cdk.out/AwsSolutions-cns427-task-api-api.csv"
118+
@echo " - cdk.out/AwsSolutions-cns427-task-api-monitoring.csv"
119+
@echo " - cdk.out/*.json (JSON format)"
120+
121+
check: lint type-check cdk-nag
122+
@echo "✅ All quality checks passed!"
123+
124+
# Deployment
125+
deploy:
126+
@echo "Deploying main application to AWS..."
127+
poetry run deploy
128+
129+
destroy:
130+
@echo "Destroying main application..."
131+
poetry run destroy
132+
133+
# Cleanup
134+
clean:
135+
@echo "Cleaning build artifacts..."
136+
rm -rf .pytest_cache/
137+
rm -rf htmlcov/
138+
rm -rf .coverage
139+
rm -rf coverage.xml
140+
rm -rf cdk.out/
141+
rm -rf infrastructure/test_harness/cdk.out/
142+
rm -rf cdk-outputs.json
143+
rm -rf .mypy_cache/
144+
rm -rf .ruff_cache/
145+
rm -rf .venv/
146+
find . -type d -name "__pycache__" -exec rm -rf {} +
147+
find . -type f -name "*.pyc" -delete

0 commit comments

Comments
 (0)