Skip to content

Commit

Permalink
support hostNetwork e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: faceair <[email protected]>
  • Loading branch information
faceair committed Jan 30, 2021
1 parent 954102b commit c2cd1b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/e2e/sidecar_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (suite *SidecarNamespaceTestSuite) TestSidecarNamespace() {
cleanupOptions := &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval}

jaegerInstanceName := "agent-as-sidecar-namespace"
j := createJaegerAgentAsSidecarInstance(jaegerInstanceName, namespace)
j := createJaegerAgentAsSidecarInstance(jaegerInstanceName, namespace, &falseVar)
defer undeployJaegerInstance(j)

dep := getVertxDefinition(namespace, map[string]string{})
Expand Down
13 changes: 8 additions & 5 deletions test/e2e/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
)

var ingressEnabled = true
var trueVar = true
var falseVar = true

type SidecarTestSuite struct {
suite.Suite
Expand Down Expand Up @@ -70,8 +72,8 @@ func (suite *SidecarTestSuite) AfterTest(suiteName, testName string) {
func (suite *SidecarTestSuite) TestSidecar() {
cleanupOptions := &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval}

firstJaegerInstanceName := "agent-as-sidecar"
firstJaegerInstance := createJaegerAgentAsSidecarInstance(firstJaegerInstanceName, namespace)
firstJaegerInstanceName := "agent-as-sidecar-with-hostnetowk"
firstJaegerInstance := createJaegerAgentAsSidecarInstance(firstJaegerInstanceName, namespace, &trueVar)
defer undeployJaegerInstance(firstJaegerInstance)

verifyAllInOneImage(firstJaegerInstanceName, namespace, specifyOtelImages)
Expand Down Expand Up @@ -104,7 +106,7 @@ func (suite *SidecarTestSuite) TestSidecar() {

/* Testing other instance */
secondJaegerInstanceName := "agent-as-sidecar2"
secondJaegerInstance := createJaegerAgentAsSidecarInstance(secondJaegerInstanceName, namespace)
secondJaegerInstance := createJaegerAgentAsSidecarInstance(secondJaegerInstanceName, namespace, &falseVar)
defer undeployJaegerInstance(secondJaegerInstance)

persisted := &appsv1.Deployment{}
Expand All @@ -113,7 +115,7 @@ func (suite *SidecarTestSuite) TestSidecar() {
Namespace: namespace,
}, persisted)
require.NoError(t, err, "Error getting jaeger instance")
require.Equal(t, "agent-as-sidecar", persisted.Labels[inject.Label])
require.Equal(t, firstJaegerInstanceName, persisted.Labels[inject.Label])

err = fw.Client.Delete(goctx.TODO(), firstJaegerInstance)
require.NoError(t, err, "Error deleting instance")
Expand Down Expand Up @@ -196,7 +198,7 @@ func getVertxDefinition(deploymentName string, annotations map[string]string) *a
return dep
}

func createJaegerAgentAsSidecarInstance(name, namespace string) *v1.Jaeger {
func createJaegerAgentAsSidecarInstance(name, namespace string, hostNetwork *bool) *v1.Jaeger {
cleanupOptions := &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval}

j := &v1.Jaeger{
Expand All @@ -216,6 +218,7 @@ func createJaegerAgentAsSidecarInstance(name, namespace string) *v1.Jaeger {
},
AllInOne: v1.JaegerAllInOneSpec{},
Agent: v1.JaegerAgentSpec{
HostNetwork: hostNetwork,
Options: v1.NewOptions(map[string]interface{}{
"log-level": "debug",
}),
Expand Down

0 comments on commit c2cd1b0

Please sign in to comment.