Skip to content

Commit 8a92c22

Browse files
authored
rename hyphenated packages: http-helper, dns-helper, test-structure (#1844)
Rebased onto the post-freeze main (v1.0.1 cut). Moves the three dirs, renames package declarations (drops the staticcheck nolint), rewrites import paths, drops redundant aliases, normalizes call sites, updates docs/examples, and renames the eponymous files. First step of the v2 modularization.
1 parent b9650d0 commit 8a92c22

49 files changed

Lines changed: 199 additions & 199 deletions

Some content is hidden

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

docs/_docs/01_getting-started/packages-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Terratest's [modules folder](https://github.com/gruntwork-io/terratest/tree/main
2525
| **gcp** | Functions that make it easier to work with the GCP APIs. Examples: Add labels to a Compute Instance, get the Public IPs of an Instance, Get a list of Instances in a Managed Instance Group, Work with Storage Buckets and Objects. |
2626
| **git** | Functions for working with Git. Examples: get the name of the current Git branch. |
2727
| **helm** | Functions for working with Helm. Examples: Install a Helm chart. |
28-
| **http-helper** | Functions for making HTTP requests. Examples: make an HTTP request to a URL and check the status code and body contain the expected values, run a simple HTTP server locally. |
28+
| **httphelper** | Functions for making HTTP requests. Examples: make an HTTP request to a URL and check the status code and body contain the expected values, run a simple HTTP server locally. |
2929
| **k8s** | Functions that make it easier to work with Kubernetes. Examples: Getting the list of nodes in a cluster, waiting until all nodes in a cluster is ready. |
3030
| **logger** | A replacement for Go's `t.Log` and `t.Logf` that writes the logs to `stdout` immediately, rather than buffering them until the very end of the test. This makes debugging and iterating easier. |
3131
| **logger/parser** | Includes functions for parsing out interleaved go test output and piecing out the individual test logs. Used by the [terratest_log_parser](https://github.com/gruntwork-io/terratest/tree/main/cmd/terratest_log_parser) command. |
@@ -37,4 +37,4 @@ Terratest's [modules folder](https://github.com/gruntwork-io/terratest/tree/main
3737
| **ssh** | Functions to SSH to servers. Examples: SSH to a server, execute a command, and return `stdout` and `stderr`. |
3838
| **terraform** | Functions for working with Terraform. Examples: run `terraform init`, `terraform apply`, `terraform destroy`. |
3939
| **terragrunt** | Functions for working with Terragrunt. Examples: run `terragrunt apply --all`, `terragrunt destroy --all`, test stack configurations with dependencies, and work with Terragrunt stacks. |
40-
| **test_structure** | Functions for structuring your tests to speed up local iteration. Examples: break up your tests into stages so that any stage can be skipped by setting an environment variable. |
40+
| **teststructure** | Functions for structuring your tests to speed up local iteration. Examples: break up your tests into stages so that any stage can be skipped by setting an environment variable. |

docs/_docs/02_testing-best-practices/iterating-locally-using-test-stages.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ layout: collection-browser-doc
33
title: Iterating locally using test stages
44
category: testing-best-practices
55
excerpt: >-
6-
Learn more about Terratest's `test_structure`.
7-
tags: ["testing-best-practices", "test_structure"]
6+
Learn more about Terratest's `teststructure`.
7+
tags: ["testing-best-practices", "teststructure"]
88
order: 210
99
nav_title: Documentation
1010
nav_title_link: /docs/
@@ -21,7 +21,7 @@ Often, while testing locally, you'll want to re-run some subset of these stages
2121
might want to repeatedly run the validation step while you work out the kinks. Having to run _all_ of these stages
2222
each time you change a single line of code can be very slow.
2323

24-
This is where Terratest's `test_structure` package comes in handy: it allows you to explicitly break up your tests into
24+
This is where Terratest's `teststructure` package comes in handy: it allows you to explicitly break up your tests into
2525
stages and to be able to disable any one of those stages by setting an environment variable. Check out the
2626
[terraform_packer_example_test.go](https://github.com/gruntwork-io/terratest/blob/main/test/terraform_packer_example_test.go)
2727
for working sample code.

docs/_docs/03_migrating-to-v1/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ warnings over the table when they disagree.
6161

6262
The Context migration is the single largest source of deprecation
6363
warnings you will see when upgrading. It touches nearly every helper
64-
package: `terraform`, `helm`, `dns-helper`, `http-helper`, `packer`,
64+
package: `terraform`, `helm`, `dnshelper`, `httphelper`, `packer`,
6565
`docker`, `ssh`, `oci`, `k8s`, `aws`, `azure`, `gcp`. The non-`Context`
6666
variants compile and behave the same as before; they just emit a
6767
`// Deprecated:` godoc warning.

docs/_docs/04_community/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Here are the guidelines for contributions with external tools:
6666
These are helper functions for creating, destroying, and validating infrastructure directly via API calls or SDKs.
6767
Examples:
6868

69-
* `http_helper.HTTPGetWithRetryContext`: make an HTTP request, retrying until you get a certain expected response.
69+
* `httphelper.HTTPGetWithRetryContext`: make an HTTP request, retrying until you get a certain expected response.
7070
* `ssh.CheckSSHCommandContext`: SSH to a server and execute a command.
7171
* `aws.CreateS3BucketContext`: create an S3 bucket.
7272
* `aws.GetPrivateIpsOfEc2InstancesContext`: use the AWS APIs to fetch IPs of some EC2 instances.

examples/terraform-asg-scp-example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ aws.FetchFilesFromInstanceContext(t, ctx, awsRegion, sshUserName, keyPair, appSe
5050
Finally, to put all of this together, in your go test you could do something like:
5151

5252
```go
53-
defer test_structure.RunTestStage(t, "grab_logs", func() {
53+
defer teststructure.RunTestStage(t, "grab_logs", func() {
5454
if t.Failed() {
5555
takeElkMultiClusterLogSnapshot(t, examplesDir, awsRegion, "ubuntu")
5656
}

modules/dns-helper/dns_local_server_test.go renamed to modules/dnshelper/dns_local_server_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dns_helper_test //nolint:staticcheck // package name determined by directory
1+
package dnshelper_test
22

33
import (
44
"fmt"
@@ -8,7 +8,7 @@ import (
88
"testing"
99
"time"
1010

11-
dnshelper "github.com/gruntwork-io/terratest/modules/dns-helper"
11+
"github.com/gruntwork-io/terratest/modules/dnshelper"
1212
"github.com/miekg/dns"
1313
)
1414

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Package dns_helper contains helpers to interact with the Domain Name System.
2-
package dns_helper //nolint:staticcheck // package name determined by directory
1+
// Package dnshelper contains helpers to interact with the Domain Name System.
2+
package dnshelper
33

44
import (
55
"context"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package dns_helper_test //nolint:staticcheck // package name determined by directory
1+
package dnshelper_test
22

33
import (
44
"testing"
55
"time"
66

7-
dnshelper "github.com/gruntwork-io/terratest/modules/dns-helper"
7+
"github.com/gruntwork-io/terratest/modules/dnshelper"
88
"github.com/gruntwork-io/terratest/modules/retry"
99
"github.com/stretchr/testify/require"
1010
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dns_helper //nolint:staticcheck // package name determined by directory
1+
package dnshelper
22

33
import "fmt"
44

modules/docker/stop_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/gruntwork-io/terratest/modules/docker"
12-
http_helper "github.com/gruntwork-io/terratest/modules/http-helper"
12+
"github.com/gruntwork-io/terratest/modules/httphelper"
1313
"github.com/gruntwork-io/terratest/modules/shell"
1414
"github.com/stretchr/testify/require"
1515
)
@@ -40,7 +40,7 @@ func TestStop(t *testing.T) {
4040
docker.RunContext(t, ctx, "nginx:1.17-alpine", runOpts)
4141

4242
// verify nginx is running
43-
http_helper.HTTPGetWithRetryWithCustomValidationContext(t, ctx, testURL, &tls.Config{}, 60, 2*time.Second, verifyNginxIsUp)
43+
httphelper.HTTPGetWithRetryWithCustomValidationContext(t, ctx, testURL, &tls.Config{}, 60, 2*time.Second, verifyNginxIsUp)
4444

4545
// try to stop it now
4646
out := docker.StopContext(t, ctx, []string{name}, &docker.StopOptions{})

0 commit comments

Comments
 (0)