8000 Merge pull request #1559 from gruntwork-io/bug/helm-basic-example-dep… · gruntwork-io/terratest@5c7c088 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c7c088

Browse files
authored
Merge pull request #1559 from gruntwork-io/bug/helm-basic-example-deployment-no-such-host-1174
fix: Helm example deployment test
2 parents c3ca221 + 6e1d6a0 commit 5c7c088

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/helm_basic_example_integration_test.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package test
1111
import (
1212
"crypto/tls"
1313
"fmt"
14+
"net/http"
1415
"path/filepath"
1516
"strings"
1617
"testing"
@@ -56,6 +57,9 @@ func TestHelmBasicExampleDeployment(t *testing.T) {
5657
"containerImageRepo": "nginx",
5758
"containerImageTag": "1.15.8",
5859
},
60+
ExtraArgs: map[string][]string{
61+
"install": []string{"--wait", "--timeout", "1m30s"},
62+
},
5963
}
6064

< CE8D code>6165
// We generate a unique release name so that we can refer to after deployment.
@@ -81,10 +85,13 @@ func TestHelmBasicExampleDeployment(t *testing.T) {
8185
// to ensure that we can access it.
8286
k8s.WaitUntilServiceAvailable(t, kubectlOptions, serviceName, 10, 1*time.Second)
8387

84-
// Now we verify that the service will successfully boot and start serving requests
85-
service := k8s.GetService(t, kubectlOptions, serviceName)
86-
endpoint := k8s.GetServiceEndpoint(t, kubectlOptions, service, 80)
87-
88+
// Now we open a tunnel to port forward service port to localhost
89+
tunnel := k8s.NewTunnel(
90+
kubectlOptions, k8s.ResourceTypeService, serviceName, 0, 80)
91+
defer tunnel.Close()
92+
tunnel.ForwardPort(t)
93+
// Get endpoint
94+
endpoint := tunnel.Endpoint()
8895
// Setup a TLS configuration to submit with the helper, a blank struct is acceptable
8996
tlsConfig := tls.Config{}
9097

@@ -97,7 +104,7 @@ func TestHelmBasicExampleDeployment(t *testing.T) {
97104
30,
98105
10*time.Second,
99106
func(statusCode int, body string) bool {
100-
return statusCode == 200
107+
return statusCode == http.StatusOK
101108
},
102109
)
103110
}

0 commit comments

Comments
 (0)
0