Skip to content

Commit

Permalink
Fix these tests to work properly when using OTEL images (#1280)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Earls <[email protected]>

i.e. when using 2.0 and running with SPECIFY_OTEL_ONFIG set to true
  • Loading branch information
kevinearls authored Oct 28, 2020
1 parent 6c179bb commit fda5695
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
34 changes: 22 additions & 12 deletions test/e2e/autoscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (suite *AutoscaleTestSuite) TestAutoScaleCollector() {

jaegerInstanceName := "simple-prod"
jaegerInstance := getSimpleProd(jaegerInstanceName, namespace, cpuResourceLimit, memoryResourceLimit)
createAndWaitFor(jaegerInstance, jaegerInstanceName)
createAndWaitFor(jaegerInstance, jaegerInstanceName, false)
defer undeployJaegerInstance(jaegerInstance)

tracegen := createTracegenDeployment(jaegerInstanceName, namespace, tracegenDurationInMinutes, replicas)
Expand All @@ -97,7 +97,7 @@ func (suite *AutoscaleTestSuite) TestAutoScaleIngester() {

jaegerInstanceName := "simple-streaming"
jaegerInstance := getSimpleStreaming(jaegerInstanceName, namespace)
createAndWaitFor(jaegerInstance, jaegerInstanceName)
createAndWaitFor(jaegerInstance, jaegerInstanceName, true)
defer undeployJaegerInstance(jaegerInstance)

tracegenReplicas := int32(1)
Expand All @@ -107,13 +107,18 @@ func (suite *AutoscaleTestSuite) TestAutoScaleIngester() {
waitUntilScales(jaegerInstanceName, "ingester")
}

func createAndWaitFor(jaegerInstance *v1.Jaeger, jaegerInstanceName string) {
func createAndWaitFor(jaegerInstance *v1.Jaeger, jaegerInstanceName string, waitForIngester bool) {
err := fw.Client.Create(context.TODO(), jaegerInstance, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")

err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, jaegerInstanceName+"-collector", 1, retryInterval, timeout)
require.NoError(t, err, "Error waiting for collector deployment")

if waitForIngester {
err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, jaegerInstanceName+"-ingester", 1, retryInterval, timeout)
require.NoError(t, err, "Error waiting for collector deployment")
}

err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, jaegerInstanceName+"-query", 1, retryInterval, timeout)
require.NoError(t, err, "Error waiting for query deployment")
logrus.Infof("Jaeger instance %s finished deploying in %s", jaegerInstanceName, namespace)
Expand Down Expand Up @@ -162,9 +167,19 @@ func getSimpleStreaming(name, namespace string) *v1.Jaeger {
collectorOptions := make(map[string]interface{})
collectorOptions["kafka.producer.topic"] = "jaeger-spans"
collectorOptions["kafka.producer.brokers"] = kafkaClusterURL
collectorOptions["kafka.producer.batch-linger"] = "1s"
collectorOptions["kafka.producer.batch-size"] = "128000"
collectorOptions["kafka.producer.batch-max-messages"] = "100"
if !specifyOtelConfig {
collectorOptions["kafka.producer.batch-linger"] = "1s"
collectorOptions["kafka.producer.batch-size"] = "128000"
collectorOptions["kafka.producer.batch-max-messages"] = "100"
}

ingesterOptions := make(map[string]interface{})
ingesterOptions["kafka.consumer.topic"] = "jaeger-spans"
ingesterOptions["kafka.consumer.brokers"] = kafkaClusterURL
if !specifyOtelConfig {
ingesterOptions["ingester.parallelism"] = "6900"
ingesterOptions["ingester.deadlockInterval"] = 0
}

autoscale := true
var minReplicas int32 = 1
Expand Down Expand Up @@ -193,12 +208,7 @@ func getSimpleStreaming(name, namespace string) *v1.Jaeger {
},
},
},
Options: v1.NewOptions(map[string]interface{}{
"kafka.consumer.topic": "jaeger-spans",
"kafka.consumer.brokers": kafkaClusterURL,
"ingester.deadlockInterval": "0",
"ingester.parallelism": "6900",
}),
Options: v1.NewOptions(ingesterOptions),
AutoScaleSpec: v1.AutoScaleSpec{
Autoscale: &autoscale,
MinReplicas: &minReplicas,
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ func getJaegerSimpleProdWithServerUrls(name string) *v1.Jaeger {
if specifyOtelImages {
logrus.Infof("Using OTEL collector for %s", name)
exampleJaeger.Spec.Collector.Image = otelCollectorImage
}

if specifyOtelConfig {
exampleJaeger.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
}

Expand Down
4 changes: 0 additions & 4 deletions test/e2e/self_provisioned_elasticsearch_kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ func getJaegerSelfProvisionedESAndKafka(instanceName string) *v1.Jaeger {
if specifyOtelImages {
logrus.Infof("Using OTEL collector for %s", instanceName)
jaegerInstance.Spec.Collector.Image = otelCollectorImage
}

if specifyOtelConfig {
jaegerInstance.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))

}

return jaegerInstance
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/self_provisioned_elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ func getJaegerSimpleProd(instanceName string) *v1.Jaeger {
if specifyOtelImages {
logrus.Infof("Using OTEL collector for %s", instanceName)
exampleJaeger.Spec.Collector.Image = otelCollectorImage
}

if specifyOtelConfig {
exampleJaeger.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
}

Expand Down
2 changes: 0 additions & 2 deletions test/e2e/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,7 @@ func createJaegerAgentAsSidecarInstance(name, namespace string) *v1.Jaeger {
j.Spec.AllInOne.Image = otelAllInOneImage
logrus.Infof("Using OTEL Agent for %s", name)
j.Spec.Agent.Image = otelAgentImage
}

if specifyOtelConfig {
j.Spec.AllInOne.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
j.Spec.Agent.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
}
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/streaming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,6 @@ func jaegerStreamingDefinition(namespace string, name string) *v1.Jaeger {
j.Spec.Collector.Image = otelCollectorImage
log.Infof("Using OTEL ingester for %s", name)
j.Spec.Ingester.Image = otelIngesterImage
}

if specifyOtelConfig {
j.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
j.Spec.Ingester.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14270"))
}
Expand Down Expand Up @@ -282,9 +279,7 @@ func jaegerStreamingDefinitionWithTLS(namespace string, name, kafkaUserName stri
j.Spec.Collector.Image = otelCollectorImage
log.Infof("Using OTEL ingester for %s", name)
j.Spec.Ingester.Image = otelIngesterImage
}

if specifyOtelConfig {
j.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
j.Spec.Ingester.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14270"))
}
Expand Down Expand Up @@ -323,9 +318,7 @@ func jaegerAutoProvisionedDefinition(namespace string, name string) *v1.Jaeger {
jaegerInstance.Spec.Collector.Image = otelCollectorImage
log.Infof("Using OTEL ingester for %s", name)
jaegerInstance.Spec.Ingester.Image = otelIngesterImage
}

if specifyOtelConfig {
jaegerInstance.Spec.Collector.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
jaegerInstance.Spec.Ingester.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14270"))
}
Expand Down

0 comments on commit fda5695

Please sign in to comment.