Skip to content

Comments

fix(perforce): restructure tests and fix pre-existing module bugs#870

Open
hwkiem wants to merge 2 commits intomainfrom
fix/perforce-test-infrastructure-and-bugs
Open

fix(perforce): restructure tests and fix pre-existing module bugs#870
hwkiem wants to merge 2 commits intomainfrom
fix/perforce-test-infrastructure-and-bugs

Conversation

@hwkiem
Copy link
Contributor

@hwkiem hwkiem commented Feb 14, 2026

Summary

  • Flatten test directory structure: move tests from tests/unit/ to tests/
  • Delete integration tests that require AWS credentials and SSM parameters
  • Fix pre-existing bugs in the Perforce root module that were masked by a missing provider declaration

Bug Fixes

Provider resolution: Add netapp-ontap provider to versions.tf (required by the p4-server FSxN submodule, prevented all tests from running).

Null safety (variables.tf):

  • Add var.p4_server_config == null || guards to all 5 validation rules so the module works when P4 Server is not deployed
  • Fix inverted shared_lb_access_logs_bucket validation condition
  • Fix incorrect error message for route53_private_hosted_zone_name

Resource count conditions:

  • lb.tf: NLB→ALB target group, attachment, and HTTPS listener now require both create_shared_network_load_balancer && create_shared_application_load_balancer
  • sg.tf: NLB→ALB egress rule now also requires ALB

Reference safety:

  • main.tf: Add try() fallback for p4_code_reviewmodule.p4_server[0] secret ARN references (allows Code Review without P4 Server)
  • outputs.tf: Add var.p4_server_config != null guard for p4_server_lambda_link_name

Test Changes

  • Replace jsonencode() calls in mock_data blocks with raw JSON strings
  • Add explicit disabled flags (create_shared_network_load_balancer = false, etc.) to test variables
  • Fix assertion resource names (lb_access_logsshared_lb_access_logs_bucket)
  • Fix FQDN/zone name mismatch in full_stack test data
  • Simplify tests/README.md

Test plan

  • terraform test in modules/perforce/ — all 14 tests pass (8 conditional + 6 shared)
  • terraform fmt -check -recursive modules/perforce/ — formatting OK
  • terraform validate in modules/perforce/ — configuration valid

@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2026

📚 Documentation Preview

Preview deployed successfully!

🔗 Preview URL: https://aws-games.github.io/cloud-game-development-toolkit/preview-pr-870/

🔒 Maintainer Action Required

The preview requires approval before it's accessible. A maintainer must approve the GitHub Pages deployment in the Environments section.

Once approved, the preview will be accessible within 1-2 minutes.

Build Information

  • Status: ✅ Deployed (awaiting approval)
  • Commit: af771a45b1229e5830c95453f9c3ec799133c994
  • Workflow Run: #100

This preview will be automatically deleted when the PR is merged or closed.

Copy link
Contributor

@gabebatista gabebatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Left some minor comments regarding readability but nothing that should block the merge.

Resource = "*"
}]
})
json = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"*\",\"Resource\":\"*\"}]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the old version easier to read. Any reason this approach is better?

Version = "2012-10-17"
Statement = [{ Effect = "Allow", Action = "*", Resource = "*" }]
})
json = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"*\",\"Resource\":\"*\"}]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before, I find the old one easier to read.

Test restructuring:
- Flatten test directory (remove unit/ and integration/ subdirectories)
- Delete integration tests (require AWS credentials and SSM parameters)
- Replace jsonencode() in mock_data with raw JSON strings
- Add explicit disabled flags for NLB/ALB/R53 in test variables
- Fix FQDN/zone name mismatch in full_stack test data
- Fix assertion resource names (lb_access_logs → shared_lb_access_logs_bucket)
- Simplify tests/README.md

Module bug fixes:
- versions.tf: add netapp-ontap provider (required by p4-server submodule)
- variables.tf: add null guards to all p4_server_config validation rules
- variables.tf: fix inverted shared_lb_access_logs_bucket validation
- variables.tf: fix route53_private_hosted_zone_name error message
- lb.tf: require both NLB and ALB for NLB→ALB resources
- sg.tf: require ALB for NLB→ALB egress rule
- main.tf: add try() fallback for p4_code_review secret ARN references
- outputs.tf: add null guard for p4_server_lambda_link_name
@hwkiem hwkiem force-pushed the fix/perforce-test-infrastructure-and-bugs branch from b75d680 to af771a4 Compare February 17, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants