generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #404 from ministryofjustice/feature/add-README-file
Added missing README file and updated the unit test name
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Terratest Unit Tests | ||
|
||
## Initialisation | ||
|
||
On first set up of a new repository, run: | ||
|
||
``` | ||
go mod init github.com/ministryofjustice/<repo-name> | ||
``` | ||
|
||
Then run: | ||
|
||
``` | ||
go mod tidy | ||
``` | ||
|
||
# How to run the tests locally | ||
|
||
Run the tests from within the `test` directory using the `testing-test` user credentials. | ||
|
||
Get the credentials from https://moj.awsapps.com selecting the testing-test AWS account. | ||
|
||
Copy the credentials and export them by pasting them into the terminal from which you will run the tests. | ||
|
||
Next go into the testing folder and run the tests. | ||
|
||
``` | ||
cd test | ||
go mod download | ||
go test -v | ||
``` | ||
|
||
Upon successful run, you should see an output similar to the below | ||
|
||
``` | ||
TestLBCreation 2024-04-26T11:30:07+01:00 logger.go:66: Destroy complete! Resources: 17 destroyed. | ||
TestLBCreation 2024-04-26T11:30:07+01:00 logger.go:66: | ||
--- PASS: TestLBCreation (283.85s) | ||
PASS | ||
ok github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket 284.181s | ||
``` | ||
|
||
## References | ||
|
||
1. https://terratest.gruntwork.io/docs/getting-started/quick-start/ | ||
2. https://github.com/ministryofjustice/modernisation-platform-terraform-loadbalancer/blob/main/.github/workflows/go-terratest.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters