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

fix: Helm example deployment test #1175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
repos:
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.10
hooks:
Expand Down
17 changes: 12 additions & 5 deletions test/helm_basic_example_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package test
import (
"crypto/tls"
"fmt"
"net/http"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -56,6 +57,9 @@ func TestHelmBasicExampleDeployment(t *testing.T) {
"containerImageRepo": "nginx",
"containerImageTag": "1.15.8",
},
ExtraArgs: map[string][]string{
"install": []string{"--wait", "--timeout", "1m30s"},
},
}

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

// Now we verify that the service will successfully boot and start serving requests
service := k8s.GetService(t, kubectlOptions, serviceName)
endpoint := k8s.GetServiceEndpoint(t, kubectlOptions, service, 80)

// Now we open a tunnel to port forward service port to localhost
tunnel := k8s.NewTunnel(
kubectlOptions, k8s.ResourceTypeService, serviceName, 0, 80)
defer tunnel.Close()
tunnel.ForwardPort(t)
// Get endpoint
endpoint := tunnel.Endpoint()
// Setup a TLS configuration to submit with the helper, a blank struct is acceptable
tlsConfig := tls.Config{}

Expand All @@ -97,7 +104,7 @@ func TestHelmBasicExampleDeployment(t *testing.T) {
30,
10*time.Second,
func(statusCode int, body string) bool {
return statusCode == 200
return statusCode == http.StatusOK
},
)
}