cdk-cost-analyzer 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cdk-cost-analyzer-cache/metadata.json +12 -0
- package/.gitlab-ci.yml +214 -0
- package/.husky/pre-commit +12 -0
- package/.kiro/hooks/accessibility-audit.kiro.hook +18 -0
- package/.kiro/hooks/api-schema-validation.kiro.hook +21 -0
- package/.kiro/hooks/auto-test-on-save.kiro.hook +19 -0
- package/.kiro/hooks/cdk-synth-on-change.kiro.hook +20 -0
- package/.kiro/hooks/code-coverage-check.kiro.hook +14 -0
- package/.kiro/hooks/commit-message-helper.kiro.hook +14 -0
- package/.kiro/hooks/dependency-update-check.kiro.hook +14 -0
- package/.kiro/hooks/env-file-validation.kiro.hook +18 -0
- package/.kiro/hooks/lint-and-format-on-save.kiro.hook +21 -0
- package/.kiro/hooks/mcp-config-validation.kiro.hook +17 -0
- package/.kiro/hooks/mcp-server-test.kiro.hook +14 -0
- package/.kiro/hooks/performance-analysis.kiro.hook +14 -0
- package/.kiro/hooks/readme-spell-check.kiro.hook +14 -0
- package/.kiro/hooks/security-scan-on-dependency-change.kiro.hook +21 -0
- package/.kiro/hooks/translation-update.kiro.hook +18 -0
- package/.kiro/hooks/update-documentation.kiro.hook +18 -0
- package/.kiro/settings/mcp.json +20 -0
- package/.kiro/specs/cdk-cost-analyzer/design.md +620 -0
- package/.kiro/specs/cdk-cost-analyzer/requirements.md +183 -0
- package/.kiro/specs/cdk-cost-analyzer/tasks.md +357 -0
- package/.kiro/specs/github-actions-ci/design.md +281 -0
- package/.kiro/specs/github-actions-ci/requirements.md +86 -0
- package/.kiro/specs/github-actions-ci/tasks.md +115 -0
- package/.kiro/specs/nlb-calculator-test-coverage/design.md +190 -0
- package/.kiro/specs/nlb-calculator-test-coverage/requirements.md +84 -0
- package/.kiro/specs/nlb-calculator-test-coverage/tasks.md +150 -0
- package/.kiro/specs/production-readiness/design.md +1213 -0
- package/.kiro/specs/production-readiness/requirements.md +312 -0
- package/.kiro/specs/production-readiness/tasks.md +269 -0
- package/.kiro/specs/repository-cleanup/design.md +283 -0
- package/.kiro/specs/repository-cleanup/requirements.md +74 -0
- package/.kiro/specs/repository-cleanup/tasks.md +64 -0
- package/.kiro/steering/aws-cli-best-practices.md +41 -0
- package/.kiro/steering/cdk-best-practices.md +49 -0
- package/.kiro/steering/development-standards.md +54 -0
- package/.kiro/steering/docker-best-practices.md +34 -0
- package/.kiro/steering/documentation-style.md +151 -0
- package/.kiro/steering/git-best-practices.md +37 -0
- package/.kiro/steering/mcp-best-practices.md +95 -0
- package/.kiro/steering/python-best-practices.md +48 -0
- package/.kiro/steering/react-best-practices.md +44 -0
- package/.kiro/steering/security-best-practices.md +41 -0
- package/.kiro/steering/testing-best-practices.md +59 -0
- package/.kiro/steering/typescript-best-practices.md +40 -0
- package/CHANGELOG.md +49 -0
- package/CONTRIBUTING.md +258 -0
- package/LICENSE +19 -0
- package/README.md +480 -0
- package/SECURITY.md +117 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.js +65 -0
- package/dist/api/types.d.ts +15 -0
- package/dist/api/types.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +262 -0
- package/dist/config/ConfigManager.d.ts +40 -0
- package/dist/config/ConfigManager.js +238 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +19 -0
- package/dist/config/types.d.ts +72 -0
- package/dist/config/types.js +15 -0
- package/dist/diff/DiffEngine.d.ts +7 -0
- package/dist/diff/DiffEngine.js +73 -0
- package/dist/diff/index.d.ts +2 -0
- package/dist/diff/index.js +21 -0
- package/dist/diff/types.d.ts +20 -0
- package/dist/diff/types.js +3 -0
- package/dist/integrations/GitLabIntegration.d.ts +7 -0
- package/dist/integrations/GitLabIntegration.js +45 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.js +21 -0
- package/dist/integrations/types.d.ts +11 -0
- package/dist/integrations/types.js +13 -0
- package/dist/parser/TemplateParser.d.ts +8 -0
- package/dist/parser/TemplateParser.js +75 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.js +22 -0
- package/dist/parser/types.d.ts +30 -0
- package/dist/parser/types.js +3 -0
- package/dist/pipeline/PipelineOrchestrator.d.ts +23 -0
- package/dist/pipeline/PipelineOrchestrator.js +191 -0
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +19 -0
- package/dist/pipeline/types.d.ts +41 -0
- package/dist/pipeline/types.js +13 -0
- package/dist/pricing/CacheManager.d.ts +75 -0
- package/dist/pricing/CacheManager.js +195 -0
- package/dist/pricing/PricingClient.d.ts +17 -0
- package/dist/pricing/PricingClient.js +122 -0
- package/dist/pricing/PricingService.d.ts +16 -0
- package/dist/pricing/PricingService.js +149 -0
- package/dist/pricing/calculators/ALBCalculator.d.ts +16 -0
- package/dist/pricing/calculators/ALBCalculator.js +163 -0
- package/dist/pricing/calculators/APIGatewayCalculator.d.ts +10 -0
- package/dist/pricing/calculators/APIGatewayCalculator.js +177 -0
- package/dist/pricing/calculators/CloudFrontCalculator.d.ts +59 -0
- package/dist/pricing/calculators/CloudFrontCalculator.js +151 -0
- package/dist/pricing/calculators/DynamoDBCalculator.d.ts +9 -0
- package/dist/pricing/calculators/DynamoDBCalculator.js +146 -0
- package/dist/pricing/calculators/EC2Calculator.d.ts +7 -0
- package/dist/pricing/calculators/EC2Calculator.js +80 -0
- package/dist/pricing/calculators/ECSCalculator.d.ts +9 -0
- package/dist/pricing/calculators/ECSCalculator.js +116 -0
- package/dist/pricing/calculators/ElastiCacheCalculator.d.ts +8 -0
- package/dist/pricing/calculators/ElastiCacheCalculator.js +106 -0
- package/dist/pricing/calculators/LambdaCalculator.d.ts +13 -0
- package/dist/pricing/calculators/LambdaCalculator.js +111 -0
- package/dist/pricing/calculators/NLBCalculator.d.ts +16 -0
- package/dist/pricing/calculators/NLBCalculator.js +138 -0
- package/dist/pricing/calculators/NatGatewayCalculator.d.ts +12 -0
- package/dist/pricing/calculators/NatGatewayCalculator.js +116 -0
- package/dist/pricing/calculators/RDSCalculator.d.ts +9 -0
- package/dist/pricing/calculators/RDSCalculator.js +103 -0
- package/dist/pricing/calculators/S3Calculator.d.ts +8 -0
- package/dist/pricing/calculators/S3Calculator.js +68 -0
- package/dist/pricing/calculators/VPCEndpointCalculator.d.ts +12 -0
- package/dist/pricing/calculators/VPCEndpointCalculator.js +129 -0
- package/dist/pricing/index.d.ts +10 -0
- package/dist/pricing/index.js +37 -0
- package/dist/pricing/types.d.ts +53 -0
- package/dist/pricing/types.js +22 -0
- package/dist/releasetag.txt +1 -0
- package/dist/reporter/Reporter.d.ts +18 -0
- package/dist/reporter/Reporter.js +412 -0
- package/dist/reporter/index.d.ts +2 -0
- package/dist/reporter/index.js +21 -0
- package/dist/reporter/types.d.ts +72 -0
- package/dist/reporter/types.js +3 -0
- package/dist/synthesis/SynthesisOrchestrator.d.ts +26 -0
- package/dist/synthesis/SynthesisOrchestrator.js +243 -0
- package/dist/synthesis/index.d.ts +2 -0
- package/dist/synthesis/index.js +19 -0
- package/dist/synthesis/types.d.ts +17 -0
- package/dist/synthesis/types.js +13 -0
- package/dist/threshold/ThresholdEnforcer.d.ts +29 -0
- package/dist/threshold/ThresholdEnforcer.js +143 -0
- package/dist/threshold/index.d.ts +2 -0
- package/dist/threshold/index.js +19 -0
- package/dist/threshold/types.d.ts +15 -0
- package/dist/threshold/types.js +17 -0
- package/docs/CALCULATORS.md +820 -0
- package/docs/CI_CD.md +608 -0
- package/docs/CONFIGURATION.md +407 -0
- package/docs/DEVELOPMENT.md +387 -0
- package/docs/RELEASE.md +223 -0
- package/docs/TROUBLESHOOTING.md +847 -0
- package/examples/.cdk-cost-analyzer.yml +85 -0
- package/examples/.gitlab-ci.yml +125 -0
- package/examples/api-usage.js +26 -0
- package/examples/complex/base.json +16 -0
- package/examples/complex/target.json +29 -0
- package/examples/monorepo/.gitlab-ci.yml +251 -0
- package/examples/monorepo/README.md +341 -0
- package/examples/monorepo/package.json +27 -0
- package/examples/monorepo/packages/backend-infra/.cdk-cost-analyzer.yml +34 -0
- package/examples/monorepo/packages/backend-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/backend-infra/cdk.json +7 -0
- package/examples/monorepo/packages/backend-infra/lib/backend-stack.ts +128 -0
- package/examples/monorepo/packages/backend-infra/package.json +30 -0
- package/examples/monorepo/packages/backend-infra/tsconfig.json +11 -0
- package/examples/monorepo/packages/data-infra/.cdk-cost-analyzer.yml +38 -0
- package/examples/monorepo/packages/data-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/data-infra/cdk.json +7 -0
- package/examples/monorepo/packages/data-infra/lib/data-stack.ts +121 -0
- package/examples/monorepo/packages/data-infra/package.json +30 -0
- package/examples/monorepo/packages/data-infra/tsconfig.json +11 -0
- package/examples/monorepo/packages/frontend-infra/.cdk-cost-analyzer.yml +31 -0
- package/examples/monorepo/packages/frontend-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/frontend-infra/cdk.json +7 -0
- package/examples/monorepo/packages/frontend-infra/lib/frontend-stack.ts +60 -0
- package/examples/monorepo/packages/frontend-infra/package.json +30 -0
- package/examples/monorepo/packages/frontend-infra/tsconfig.json +11 -0
- package/examples/monorepo/tsconfig.json +35 -0
- package/examples/multi-stack/.cdk-cost-analyzer.yml +72 -0
- package/examples/multi-stack/.gitlab-ci.yml +184 -0
- package/examples/multi-stack/README.md +279 -0
- package/examples/multi-stack/bin/app.ts +36 -0
- package/examples/multi-stack/cdk.json +72 -0
- package/examples/multi-stack/lib/compute-stack.ts +128 -0
- package/examples/multi-stack/lib/networking-stack.ts +69 -0
- package/examples/multi-stack/lib/storage-stack.ts +141 -0
- package/examples/multi-stack/package-lock.json +4437 -0
- package/examples/multi-stack/package.json +42 -0
- package/examples/multi-stack/tsconfig.json +34 -0
- package/examples/simple/base.json +8 -0
- package/examples/simple/target.json +14 -0
- package/examples/single-stack/.NVP +0 -0
- package/examples/single-stack/.cdk-cost-analyzer.yml +52 -0
- package/examples/single-stack/.gitlab-ci.yml +126 -0
- package/examples/single-stack/README.md +184 -0
- package/examples/single-stack/UeK +0 -0
- package/examples/single-stack/bin/app.ts +16 -0
- package/examples/single-stack/cdk.json +72 -0
- package/examples/single-stack/lib/infrastructure-stack.ts +119 -0
- package/examples/single-stack/package-lock.json +4443 -0
- package/examples/single-stack/package.json +38 -0
- package/examples/single-stack/tsconfig.json +34 -0
- package/package.json +139 -0
- package/test-cdk-project/README-COMPUTE.md +141 -0
- package/test-cdk-project/README.md +95 -0
- package/test-cdk-project/app-with-compute.js +102 -0
- package/test-cdk-project/app.js +81 -0
- package/test-cdk-project/cdk-compute.json +3 -0
- package/test-cdk-project/cdk.context.json +7 -0
- package/test-cdk-project/cdk.json +3 -0
- package/test-cdk-project/cdk.out/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out/TestStack.template.json +115 -0
- package/test-cdk-project/cdk.out/cdk.out +1 -0
- package/test-cdk-project/cdk.out/manifest.json +503 -0
- package/test-cdk-project/cdk.out/tree.json +1 -0
- package/test-cdk-project/cdk.out.base/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out.base/TestStack.template.json +115 -0
- package/test-cdk-project/cdk.out.base/cdk.out +1 -0
- package/test-cdk-project/cdk.out.base/manifest.json +503 -0
- package/test-cdk-project/cdk.out.base/tree.json +1 -0
- package/test-cdk-project/cdk.out.target/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out.target/TestStack.template.json +183 -0
- package/test-cdk-project/cdk.out.target/cdk.out +1 -0
- package/test-cdk-project/cdk.out.target/manifest.json +521 -0
- package/test-cdk-project/cdk.out.target/tree.json +1 -0
- package/test-cdk-project/package-lock.json +422 -0
- package/test-cdk-project/package.json +17 -0
- package/tools/workflows/README.md +102 -0
- package/tools/workflows/validate-workflows.js +109 -0
- package/tools/workflows/workflow-utils.ts +181 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Requirements Document
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The NLBCalculator class currently has very low test coverage (15.82% statements, 40% functions) with most functionality untested. This feature will implement comprehensive test coverage to ensure the Network Load Balancer cost calculation logic is reliable and maintainable.
|
|
6
|
+
|
|
7
|
+
## Glossary
|
|
8
|
+
|
|
9
|
+
- **NLBCalculator**: The class responsible for calculating AWS Network Load Balancer costs
|
|
10
|
+
- **NLCU**: Network Load Balancer Capacity Units - AWS pricing metric for NLB usage
|
|
11
|
+
- **PricingClient**: Interface for fetching AWS pricing data
|
|
12
|
+
- **MonthlyCost**: Data structure containing cost amount, currency, confidence level, and assumptions
|
|
13
|
+
- **ResourceWithId**: CDK resource representation with properties and metadata
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
### Requirement 1: Core Functionality Testing
|
|
18
|
+
|
|
19
|
+
**User Story:** As a developer, I want comprehensive tests for the NLBCalculator core methods, so that I can trust the cost calculations are accurate.
|
|
20
|
+
|
|
21
|
+
#### Acceptance Criteria
|
|
22
|
+
|
|
23
|
+
1. WHEN the supports method is called with "AWS::ElasticLoadBalancingV2::LoadBalancer", THE NLBCalculator SHALL return true
|
|
24
|
+
2. WHEN the supports method is called with any other resource type, THE NLBCalculator SHALL return false
|
|
25
|
+
3. WHEN calculateCost is called with a network load balancer resource, THE NLBCalculator SHALL return a valid MonthlyCost object
|
|
26
|
+
4. WHEN calculateCost is called with a non-network load balancer resource, THE NLBCalculator SHALL return zero cost with appropriate assumptions
|
|
27
|
+
|
|
28
|
+
### Requirement 2: NLCU Calculation Testing
|
|
29
|
+
|
|
30
|
+
**User Story:** As a developer, I want to verify NLCU calculations are correct, so that cost estimates reflect actual AWS billing logic.
|
|
31
|
+
|
|
32
|
+
#### Acceptance Criteria
|
|
33
|
+
|
|
34
|
+
1. WHEN calculating NLCU from new connections per second, THE NLBCalculator SHALL divide by 800 to get NLCU consumption
|
|
35
|
+
2. WHEN calculating NLCU from active connections per minute, THE NLBCalculator SHALL divide by 100,000 to get NLCU consumption
|
|
36
|
+
3. WHEN calculating NLCU from processed bytes, THE NLBCalculator SHALL convert monthly GB to hourly GB for NLCU calculation
|
|
37
|
+
4. WHEN multiple NLCU calculations are performed, THE NLBCalculator SHALL use the highest value for billing
|
|
38
|
+
5. WHEN custom usage parameters are provided, THE NLBCalculator SHALL use those instead of defaults
|
|
39
|
+
|
|
40
|
+
### Requirement 3: Region Handling Testing
|
|
41
|
+
|
|
42
|
+
**User Story:** As a developer, I want to ensure region normalization works correctly, so that pricing lookups succeed for all supported regions.
|
|
43
|
+
|
|
44
|
+
#### Acceptance Criteria
|
|
45
|
+
|
|
46
|
+
1. WHEN normalizeRegion is called with a supported AWS region code, THE NLBCalculator SHALL return the corresponding AWS pricing region name
|
|
47
|
+
2. WHEN normalizeRegion is called with an unsupported region, THE NLBCalculator SHALL return the original region string
|
|
48
|
+
3. WHEN getRegionPrefix is called with a supported AWS region code, THE NLBCalculator SHALL return the correct pricing prefix
|
|
49
|
+
4. WHEN getRegionPrefix is called with an unsupported region, THE NLBCalculator SHALL return an empty string
|
|
50
|
+
|
|
51
|
+
### Requirement 4: Error Handling Testing
|
|
52
|
+
|
|
53
|
+
**User Story:** As a developer, I want to verify error scenarios are handled gracefully, so that the application doesn't crash when pricing data is unavailable.
|
|
54
|
+
|
|
55
|
+
#### Acceptance Criteria
|
|
56
|
+
|
|
57
|
+
1. WHEN pricing client returns null for hourly rate, THE NLBCalculator SHALL return zero cost with appropriate assumptions
|
|
58
|
+
2. WHEN pricing client returns null for NLCU rate, THE NLBCalculator SHALL return zero cost with appropriate assumptions
|
|
59
|
+
3. WHEN pricing client throws an exception, THE NLBCalculator SHALL return zero cost with error message in assumptions
|
|
60
|
+
4. WHEN both pricing calls succeed, THE NLBCalculator SHALL return calculated cost with detailed assumptions
|
|
61
|
+
|
|
62
|
+
### Requirement 5: Default Values Testing
|
|
63
|
+
|
|
64
|
+
**User Story:** As a developer, I want to verify default usage parameters are applied correctly, so that cost calculations work without custom configuration.
|
|
65
|
+
|
|
66
|
+
#### Acceptance Criteria
|
|
67
|
+
|
|
68
|
+
1. WHEN no custom parameters are provided, THE NLBCalculator SHALL use 25 new connections per second
|
|
69
|
+
2. WHEN no custom parameters are provided, THE NLBCalculator SHALL use 3000 active connections per minute
|
|
70
|
+
3. WHEN no custom parameters are provided, THE NLBCalculator SHALL use 100 GB processed bytes per month
|
|
71
|
+
4. WHEN custom parameters are provided, THE NLBCalculator SHALL override the corresponding defaults
|
|
72
|
+
5. THE NLBCalculator SHALL use 730 hours per month for all time-based calculations
|
|
73
|
+
|
|
74
|
+
### Requirement 6: Cost Calculation Accuracy Testing
|
|
75
|
+
|
|
76
|
+
**User Story:** As a developer, I want to verify the final cost calculation combines all components correctly, so that users get accurate monthly cost estimates.
|
|
77
|
+
|
|
78
|
+
#### Acceptance Criteria
|
|
79
|
+
|
|
80
|
+
1. WHEN calculating total cost, THE NLBCalculator SHALL add hourly cost and NLCU cost
|
|
81
|
+
2. WHEN calculating hourly cost, THE NLBCalculator SHALL multiply hourly rate by 730 hours
|
|
82
|
+
3. WHEN calculating NLCU cost, THE NLBCalculator SHALL multiply NLCU rate by NLCU per hour by 730 hours
|
|
83
|
+
4. WHEN returning cost results, THE NLBCalculator SHALL include detailed breakdown in assumptions
|
|
84
|
+
5. WHEN calculations succeed, THE NLBCalculator SHALL set confidence level to "medium"
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Implementation Plan: NLBCalculator Test Coverage Enhancement
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This implementation plan will create comprehensive test coverage for the NLBCalculator class, improving coverage from 15.82% to over 90% through unit tests and property-based tests.
|
|
6
|
+
|
|
7
|
+
## Tasks
|
|
8
|
+
|
|
9
|
+
- [ ] 1. Set up test infrastructure and dependencies
|
|
10
|
+
- Install fast-check for property-based testing if not already available
|
|
11
|
+
- Create test directory structure for NLBCalculator tests
|
|
12
|
+
- Set up TypeScript configuration for test files
|
|
13
|
+
- _Requirements: All requirements (foundation for testing)_
|
|
14
|
+
|
|
15
|
+
- [ ] 2. Create test utilities and mocks
|
|
16
|
+
- [ ] 2.1 Implement MockPricingClient test double
|
|
17
|
+
- Create mock implementation of PricingClient interface
|
|
18
|
+
- Add methods to configure pricing responses and errors
|
|
19
|
+
- _Requirements: 4.1, 4.2, 4.3_
|
|
20
|
+
|
|
21
|
+
- [ ] 2.2 Create test resource factory
|
|
22
|
+
- Implement factory methods for creating test resources
|
|
23
|
+
- Support network load balancer, application load balancer, and generic resources
|
|
24
|
+
- _Requirements: 1.1, 1.2, 1.3, 1.4_
|
|
25
|
+
|
|
26
|
+
- [ ] 2.3 Create test data generators
|
|
27
|
+
- Implement generators for usage parameters, regions, and pricing data
|
|
28
|
+
- Support both valid and edge case scenarios
|
|
29
|
+
- _Requirements: 2.1, 2.2, 2.3, 2.4, 2.5_
|
|
30
|
+
|
|
31
|
+
- [ ] 3. Implement basic method tests
|
|
32
|
+
- [ ] 3.1 Test supports method functionality
|
|
33
|
+
- Test with AWS::ElasticLoadBalancingV2::LoadBalancer resource type
|
|
34
|
+
- Test with various other resource types
|
|
35
|
+
- _Requirements: 1.1, 1.2_
|
|
36
|
+
|
|
37
|
+
- [ ] 3.2 Write property test for supports method
|
|
38
|
+
- **Property 1: Resource Type Rejection**
|
|
39
|
+
- **Validates: Requirements 1.2**
|
|
40
|
+
|
|
41
|
+
- [ ] 3.3 Test region normalization methods
|
|
42
|
+
- Test normalizeRegion with supported and unsupported regions
|
|
43
|
+
- Test getRegionPrefix with supported and unsupported regions
|
|
44
|
+
- _Requirements: 3.1, 3.2, 3.3, 3.4_
|
|
45
|
+
|
|
46
|
+
- [ ] 3.4 Write property tests for region methods
|
|
47
|
+
- **Property 9: Unsupported Region Passthrough**
|
|
48
|
+
- **Property 10: Unsupported Region Empty Prefix**
|
|
49
|
+
- **Validates: Requirements 3.2, 3.4**
|
|
50
|
+
|
|
51
|
+
- [ ] 4. Implement NLCU calculation tests
|
|
52
|
+
- [ ] 4.1 Test individual NLCU calculations
|
|
53
|
+
- Test new connections per second calculation
|
|
54
|
+
- Test active connections per minute calculation
|
|
55
|
+
- Test processed bytes calculation
|
|
56
|
+
- _Requirements: 2.1, 2.2, 2.3_
|
|
57
|
+
|
|
58
|
+
- [ ] 4.2 Write property tests for NLCU calculations
|
|
59
|
+
- **Property 4: New Connections NLCU Calculation**
|
|
60
|
+
- **Property 5: Active Connections NLCU Calculation**
|
|
61
|
+
- **Property 6: Processed Bytes NLCU Calculation**
|
|
62
|
+
- **Validates: Requirements 2.1, 2.2, 2.3**
|
|
63
|
+
|
|
64
|
+
- [ ] 4.3 Test maximum NLCU selection logic
|
|
65
|
+
- Test with various combinations of NLCU values
|
|
66
|
+
- Verify highest value is always selected
|
|
67
|
+
- _Requirements: 2.4_
|
|
68
|
+
|
|
69
|
+
- [ ] 4.4 Write property test for maximum NLCU selection
|
|
70
|
+
- **Property 7: Maximum NLCU Selection**
|
|
71
|
+
- **Validates: Requirements 2.4**
|
|
72
|
+
|
|
73
|
+
- [ ] 5. Checkpoint - Ensure basic functionality tests pass
|
|
74
|
+
- Ensure all tests pass, ask the user if questions arise.
|
|
75
|
+
|
|
76
|
+
- [ ] 6. Implement cost calculation tests
|
|
77
|
+
- [ ] 6.1 Test default parameter usage
|
|
78
|
+
- Test constructor with no custom parameters
|
|
79
|
+
- Verify default values are used in calculations
|
|
80
|
+
- _Requirements: 5.1, 5.2, 5.3, 5.5_
|
|
81
|
+
|
|
82
|
+
- [ ] 6.2 Test custom parameter override
|
|
83
|
+
- Test constructor with custom parameters
|
|
84
|
+
- Verify custom values override defaults
|
|
85
|
+
- _Requirements: 5.4_
|
|
86
|
+
|
|
87
|
+
- [ ] 6.3 Write property test for custom parameter override
|
|
88
|
+
- **Property 8: Custom Parameter Override**
|
|
89
|
+
- **Validates: Requirements 2.5, 5.4**
|
|
90
|
+
|
|
91
|
+
- [ ] 6.4 Test cost calculation mathematics
|
|
92
|
+
- Test hourly cost calculation (rate × 730)
|
|
93
|
+
- Test NLCU cost calculation (rate × NLCU × 730)
|
|
94
|
+
- Test total cost addition
|
|
95
|
+
- _Requirements: 6.1, 6.2, 6.3_
|
|
96
|
+
|
|
97
|
+
- [ ] 6.5 Write property tests for cost calculations
|
|
98
|
+
- **Property 13: Cost Addition**
|
|
99
|
+
- **Property 14: Hourly Cost Calculation**
|
|
100
|
+
- **Property 15: NLCU Cost Calculation**
|
|
101
|
+
- **Validates: Requirements 6.1, 6.2, 6.3**
|
|
102
|
+
|
|
103
|
+
- [ ] 7. Implement error handling tests
|
|
104
|
+
- [ ] 7.1 Test null pricing responses
|
|
105
|
+
- Test when hourly rate is null
|
|
106
|
+
- Test when NLCU rate is null
|
|
107
|
+
- Verify zero cost and appropriate assumptions
|
|
108
|
+
- _Requirements: 4.1, 4.2_
|
|
109
|
+
|
|
110
|
+
- [ ] 7.2 Test pricing client exceptions
|
|
111
|
+
- Test various exception types
|
|
112
|
+
- Verify graceful error handling
|
|
113
|
+
- _Requirements: 4.3_
|
|
114
|
+
|
|
115
|
+
- [ ] 7.3 Write property test for exception handling
|
|
116
|
+
- **Property 11: Exception Handling**
|
|
117
|
+
- **Validates: Requirements 4.3**
|
|
118
|
+
|
|
119
|
+
- [ ] 8. Implement comprehensive integration tests
|
|
120
|
+
- [ ] 8.1 Test successful cost calculation flow
|
|
121
|
+
- Test end-to-end calculation with valid data
|
|
122
|
+
- Verify MonthlyCost structure and assumptions
|
|
123
|
+
- _Requirements: 1.3, 4.4, 6.4, 6.5_
|
|
124
|
+
|
|
125
|
+
- [ ] 8.2 Write property tests for successful calculations
|
|
126
|
+
- **Property 2: Valid MonthlyCost Structure**
|
|
127
|
+
- **Property 12: Successful Calculation Structure**
|
|
128
|
+
- **Validates: Requirements 1.3, 4.4, 6.4**
|
|
129
|
+
|
|
130
|
+
- [ ] 8.3 Test non-network load balancer handling
|
|
131
|
+
- Test with application load balancer
|
|
132
|
+
- Test with resources missing Type property
|
|
133
|
+
- Verify zero cost response
|
|
134
|
+
- _Requirements: 1.4_
|
|
135
|
+
|
|
136
|
+
- [ ] 8.4 Write property test for non-NLB resources
|
|
137
|
+
- **Property 3: Non-NLB Resource Zero Cost**
|
|
138
|
+
- **Validates: Requirements 1.4**
|
|
139
|
+
|
|
140
|
+
- [ ] 9. Final checkpoint and coverage verification
|
|
141
|
+
- Run test coverage analysis
|
|
142
|
+
- Verify coverage exceeds 90% for statements, branches, and functions
|
|
143
|
+
- Ensure all tests pass, ask the user if questions arise.
|
|
144
|
+
|
|
145
|
+
## Notes
|
|
146
|
+
|
|
147
|
+
- Each task references specific requirements for traceability
|
|
148
|
+
- Property tests validate universal correctness properties using fast-check
|
|
149
|
+
- Unit tests validate specific examples and edge cases
|
|
150
|
+
- Both testing approaches are complementary and necessary for comprehensive coverage
|