Skip to content

Commit

Permalink
helpers.CheckConnection -> helpers.CheckStaticServerConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
ishustava committed Aug 26, 2020
1 parent 9b70648 commit 9e78e7f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions test/acceptance/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ func Deploy(t *testing.T, options *k8s.KubectlOptions, noCleanupOnFailure bool,
RunKubectl(t, options, "wait", "--for=condition=available", fmt.Sprintf("deploy/%s", deployment.Name))
}

// checkConnection execs into a pod of the deployment given by deploymentName
// CheckStaticServerConnection execs into a pod of the deployment given by deploymentName
// and runs a curl command with the provided curlArgs.
// This function assumes that the connection is made to the static-server and expects the output
// to be "hello world" in a case of success.
// If expectSuccess is true, it will expect connection to succeed,
// otherwise it will expect failure due to intentions.
func CheckConnection(t *testing.T, options *k8s.KubectlOptions, deploymentName string, expectSuccess bool, curlArgs ...string) {
func CheckStaticServerConnection(t *testing.T, options *k8s.KubectlOptions, deploymentName string, expectSuccess bool, curlArgs ...string) {
t.Helper()

retrier := &retry.Timer{Timeout: 20 * time.Second, Wait: 500 * time.Millisecond}
Expand Down
6 changes: 3 additions & 3 deletions test/acceptance/tests/connect/connect_inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestConnectInjectDefault(t *testing.T) {
helpers.Deploy(t, ctx.KubectlOptions(), cfg.NoCleanupOnFailure, "fixtures/static-client.yaml")

t.Log("checking that connection is successful")
helpers.CheckConnection(t, ctx.KubectlOptions(), "static-client", true, "http://localhost:1234")
helpers.CheckStaticServerConnection(t, ctx.KubectlOptions(), "static-client", true, "http://localhost:1234")
}

// Test that Connect works in a secure installation,
Expand All @@ -53,7 +53,7 @@ func TestConnectInjectSecure(t *testing.T) {
helpers.Deploy(t, ctx.KubectlOptions(), cfg.NoCleanupOnFailure, "fixtures/static-client.yaml")

t.Log("checking that the connection is not successful because there's no intention")
helpers.CheckConnection(t, ctx.KubectlOptions(), "static-client", false, "http://localhost:1234")
helpers.CheckStaticServerConnection(t, ctx.KubectlOptions(), "static-client", false, "http://localhost:1234")

consulClient := consulCluster.SetupConsulClient(t, true)

Expand All @@ -66,5 +66,5 @@ func TestConnectInjectSecure(t *testing.T) {
require.NoError(t, err)

t.Log("checking that connection is successful")
helpers.CheckConnection(t, ctx.KubectlOptions(), "static-client", true, "http://localhost:1234")
helpers.CheckStaticServerConnection(t, ctx.KubectlOptions(), "static-client", true, "http://localhost:1234")
}
4 changes: 2 additions & 2 deletions test/acceptance/tests/ingress-gateway/ingress_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestIngressGateway(t *testing.T) {
// via the bounce pod. It should fail to connect with the
// static-server pod because of intentions.
t.Log("testing intentions prevent ingress")
helpers.CheckConnection(t,
helpers.CheckStaticServerConnection(t,
k8sOptions,
"bounce",
false,
Expand All @@ -93,7 +93,7 @@ func TestIngressGateway(t *testing.T) {
// Test that we can make a call to the ingress gateway
// via the bounce pod. It should route to the static-server pod.
t.Log("trying calls to ingress gateway")
helpers.CheckConnection(t,
helpers.CheckStaticServerConnection(t,
k8sOptions,
"bounce",
true,
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/tests/mesh-gateway/mesh_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestMeshGatewayDefault(t *testing.T) {
helpers.Deploy(t, primaryContext.KubectlOptions(), cfg.NoCleanupOnFailure, "fixtures/static-client.yaml")

t.Log("checking that connection is successful")
helpers.CheckConnection(t,
helpers.CheckStaticServerConnection(t,
primaryContext.KubectlOptions(),
"static-client",
true,
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestMeshGatewaySecure(t *testing.T) {
require.NoError(t, err)

t.Log("checking that connection is successful")
helpers.CheckConnection(t,
helpers.CheckStaticServerConnection(t,
primaryContext.KubectlOptions(),
"static-client",
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestTerminatingGateway(t *testing.T) {

// Test that we can make a call to the terminating gateway
t.Log("trying calls to terminating gateway")
helpers.CheckConnection(t,
helpers.CheckStaticServerConnection(t,
ctx.KubectlOptions(),
"static-client",
true,
Expand Down

0 comments on commit 9e78e7f

Please sign in to comment.