Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧪 Add unit tests where missing #6490

Closed
14 tasks done
dms1981 opened this issue Mar 14, 2024 · 10 comments
Closed
14 tasks done

🧪 Add unit tests where missing #6490

dms1981 opened this issue Mar 14, 2024 · 10 comments
Assignees

Comments

@dms1981
Copy link
Contributor

dms1981 commented Mar 14, 2024

User Story

As a Modernisation Platform Engineer
I want to add unit tests to modules where they are missing
So that I increase confidence in these modules

here is an example of tests - https://github.com/ministryofjustice/modernisation-platform-terraform-pagerduty-integration/tree/main/test

Value / Purpose

All of our modules should have unit tests. We note this in our User Guide. As part of a recent spike some gaps in our test coverage were noted, so this story should cover adding basic unit test functionality.

Useful Contacts

@dms1981

Additional Information

The following repositories were seen to lack unit tests:

  • modernisation-platform-ami-builds
  • modernisation-platform-configuration-management
  • modernisation-platform-cp-network-test
  • modernisation-platform-incident-response - (repository has been archived)
  • modernisation-platform-terraform-baselines
  • modernisation-platform-terraform-cross-account-access
  • modernisation-platform-terraform-dns-certificate
  • modernisation-platform-terraform-iam-superadmins
  • modernisation-platform-infrastructure-test - (repository has been archived)
  • modernisation-platform-terraform-member-vpc

Proposal / Unknowns

No response

Definition of Done

  • Missing unit tests added
  • New unit tests pass
  • Another team member has reviewed
  • New tickets raised for any more complicated tests required
@ASTRobinson
Copy link
Contributor

modernisation-platform-terraform-member-vpc - branch created, vpc successfully created but failing to destroy due to permissions: ministryofjustice/modernisation-platform-terraform-member-vpc#374

@ASTRobinson
Copy link
Contributor

modernisation-platform-terraform-iam-superadmins - branch created, terraform working but test failing due to permission error: ministryofjustice/modernisation-platform-terraform-iam-superadmins#362

@SteveLinden SteveLinden self-assigned this May 7, 2024
@ASTRobinson
Copy link
Contributor

ASTRobinson commented May 7, 2024

modernisation-platform-ami-builds - wip - PR-791 - lots of hard-coded values within the module pointing at MP production environments which myself & @ep-93 have tried to work around but have not maganaged to overcome for testing environment.
modernisation-platform-terraform-baselines - wip PR-470 - Baseline module already deployed to testing-test (and everywhere else) so resources would require randomising to avoid EntityAlreadyExists error messages on test.

modernisation-platform-terraform-cross-account-access - completed - PR-319
modernisation-platform-terraform-iam-superadmins - completed - PR-362
modernisation-platform-terraform-member-vpc - completed 391
modernisation-platform-terraform-dns-certificate - completed PR-249

skipping as no terraform... (question do we want follow-on tickets to implement some form of testing?)
modernisation-platform-configuration-management
modernisation-platform-cp-network-test

Not Required:
modernisation-platform-infrastructure-test - (repository has been archived)
modernisation-platform-incident-response - (repository has been archived)

@SteveLinden
Copy link
Contributor

SteveLinden commented May 23, 2024

modernisation-platform-terraform-baselines had been amended to use a more up-to-date version of the code (copied to github, pull from main, new checkout and the data pulled back) which stopped an issue on the pull in modernisation-platform which caused a failure. This has yet to be fully tested. Will investigate this further.

I attempted to sort out the test files based on the previous PR but this seems to have messed things up again. I will rebuild modernisation-platform-terraform-baseslines tomorrow and see if I can pull the data back in again.

@SteveLinden
Copy link
Contributor

Got the modernisation-platform-terraform-baselines back correctly but still issues on modernisation-platform plan. Different to previous ones so may need to look at them individually.

@SteveLinden SteveLinden removed their assignment May 28, 2024
@SteveLinden
Copy link
Contributor

Getting errors when using the baselines/secure_baseline option. OK when running against sprinkler.
I have, therefore, decided to leave this as it is for the time being while I go onto a couple of other calls and 10% time.

Will look again on Aaron's return if this remains in its current state.
"baselines/secure-baseline gives me an error on
enable_cloudtrail_s3_mgmt_events = local.enable-cloudtrail-events
and
enabled_imdsv2_regions = local.enabled_baseline_regions
Both exist in locals so I’m not sure what the issue is. "

@SteveLinden
Copy link
Contributor

The branch I have on the baselines is feature/baselines-changes-6490 for anyone to look at

@richgreen-moj
Copy link
Contributor

I've raised a PR for adding unit tests for the backup module within the baselines module ministryofjustice/modernisation-platform-terraform-baselines#492.

@richgreen-moj
Copy link
Contributor

richgreen-moj commented Jun 21, 2024

The baseline module has the following child modules:

@ASTRobinson
Copy link
Contributor

I am closing this ticket as either unit-tests have been successfully created, not required or follow-on tickets have been raised.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Modernisation Platform Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

5 participants