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

Simplify OTEL related environment variables #1255

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .ci/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ if [ "${TEST_GROUP}" = "es" ]; then
make e2e-tests-es
elif [ "${TEST_GROUP}" = "es-otel" ]; then
echo "Running elasticsearch tests with OTEL collector"
export USE_OTEL_COLLECTOR=true
export SPECIFY_OTEL_IMAGES=true
jpkrohling marked this conversation as resolved.
Show resolved Hide resolved
export SPECIFY_OTEL_CONFIG=true
make es
make e2e-tests-es
elif [ "${TEST_GROUP}" = "es-self-provisioned" ]; then
Expand All @@ -40,8 +41,8 @@ then
elif [ "${TEST_GROUP}" = "streaming-otel" ]
then
echo "Running Streaming Tests with OTEL collector and ingester"
export USE_OTEL_COLLECTOR=true
export USE_OTEL_INGESTER=true
export SPECIFY_OTEL_IMAGES=true
export SPECIFY_OTEL_CONFIG=true
make e2e-tests-streaming
elif [ "${TEST_GROUP}" = "examples1" ]
then
Expand All @@ -62,9 +63,8 @@ then
elif [ "${TEST_GROUP}" = "smoke-otel" ]
then
echo "Running Smoke Tests with OTEL collector"
export USE_OTEL_COLLECTOR=true
export USE_OTEL_AGENT=true
export USE_OTEL_ALL_IN_ONE=true
export SPECIFY_OTEL_IMAGES=true
export SPECIFY_OTEL_CONFIG=true
make e2e-tests-smoke
else
echo "Unknown TEST_GROUP [${TEST_GROUP}]"; exit 1
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (suite *ElasticSearchTestSuite) TestSimpleProd() {

// create jaeger custom resource
name := "simple-prod"
exampleJaeger := getJaegerSimpleProdWithServerUrls(name, testOtelCollector)
exampleJaeger := getJaegerSimpleProdWithServerUrls(name)
err = fw.Client.Create(context.TODO(), exampleJaeger, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")
defer undeployJaegerInstance(exampleJaeger)
Expand All @@ -100,7 +100,7 @@ func (suite *ElasticSearchTestSuite) TestSimpleProd() {
ProductionSmokeTest(name)

// Make sure we were using the correct collector image
verifyCollectorImage(name, namespace, testOtelCollector)
verifyCollectorImage(name, namespace, specifyOtelImages)
}

func (suite *ElasticSearchTestSuite) TestEsIndexCleanerWithIndexPrefix() {
Expand Down Expand Up @@ -159,7 +159,7 @@ func (suite *ElasticSearchTestSuite) TestEsIndexCleaner() {
indexWithPrefixExists("jaeger-", false)
}

func getJaegerSimpleProdWithServerUrls(name string, useOtelCollector bool) *v1.Jaeger {
func getJaegerSimpleProdWithServerUrls(name string) *v1.Jaeger {
ingressEnabled := true
exampleJaeger := &v1.Jaeger{
TypeMeta: metav1.TypeMeta{
Expand All @@ -185,9 +185,12 @@ func getJaegerSimpleProdWithServerUrls(name string, useOtelCollector bool) *v1.J
},
}

if useOtelCollector {
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
28 changes: 16 additions & 12 deletions test/e2e/self_provisioned_elasticsearch_kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import (
esv1 "github.com/jaegertracing/jaeger-operator/pkg/storage/elasticsearch/v1"
)

type SelfProvisionedTestSuite struct {
type SelfProvisionedESWithKafkaTestSuite struct {
suite.Suite
}

func (suite *SelfProvisionedTestSuite) SetupSuite() {
func (suite *SelfProvisionedESWithKafkaTestSuite) SetupSuite() {
t = suite.T()
if !isOpenShift(t) {
t.Skipf("Test %s is currently supported only on OpenShift because es-operator runs only on OpenShift\n", t.Name())
Expand Down Expand Up @@ -66,26 +66,26 @@ func (suite *SelfProvisionedTestSuite) SetupSuite() {
require.NotNil(t, namespace, "GetID failed")
}

func (suite *SelfProvisionedTestSuite) TearDownSuite() {
func (suite *SelfProvisionedESWithKafkaTestSuite) TearDownSuite() {
handleSuiteTearDown()
}

func TestSelfProvisionedSuite(t *testing.T) {
suite.Run(t, new(SelfProvisionedTestSuite))
func TestSelfProvisionedWithKafkaSuite(t *testing.T) {
suite.Run(t, new(SelfProvisionedESWithKafkaTestSuite))
}

func (suite *SelfProvisionedTestSuite) SetupTest() {
func (suite *SelfProvisionedESWithKafkaTestSuite) SetupTest() {
t = suite.T()
}

func (suite *SelfProvisionedTestSuite) AfterTest(suiteName, testName string) {
func (suite *SelfProvisionedESWithKafkaTestSuite) AfterTest(suiteName, testName string) {
handleTestFailure()
}

func (suite *SelfProvisionedTestSuite) TestSelfProvisionedESAndKafkaSmokeTest() {
func (suite *SelfProvisionedESWithKafkaTestSuite) TestSelfProvisionedESAndKafkaSmokeTest() {
// create jaeger custom resource
jaegerInstanceName := "simple-prod"
exampleJaeger := getJaegerSelfProvisionedESAndKafka(jaegerInstanceName, testOtelCollector)
exampleJaeger := getJaegerSelfProvisionedESAndKafka(jaegerInstanceName)
err := fw.Client.Create(goctx.TODO(), exampleJaeger, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")
defer undeployJaegerInstance(exampleJaeger)
Expand All @@ -112,10 +112,10 @@ func (suite *SelfProvisionedTestSuite) TestSelfProvisionedESAndKafkaSmokeTest()
ProductionSmokeTest(jaegerInstanceName)

// Make sure we were using the correct collector image
verifyCollectorImage(jaegerInstanceName, namespace, testOtelCollector)
verifyCollectorImage(jaegerInstanceName, namespace, specifyOtelImages)
}

func getJaegerSelfProvisionedESAndKafka(instanceName string, useOtelCollector bool) *v1.Jaeger {
func getJaegerSelfProvisionedESAndKafka(instanceName string) *v1.Jaeger {
ingressEnabled := true
jaegerInstance := &v1.Jaeger{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -145,10 +145,14 @@ func getJaegerSelfProvisionedESAndKafka(instanceName string, useOtelCollector bo
},
}

if useOtelCollector {
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
15 changes: 9 additions & 6 deletions test/e2e/self_provisioned_elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (suite *SelfProvisionedTestSuite) AfterTest(suiteName, testName string) {
func (suite *SelfProvisionedTestSuite) TestSelfProvisionedESSmokeTest() {
// create jaeger custom resource
jaegerInstanceName := "simple-prod"
exampleJaeger := getJaegerSimpleProd(jaegerInstanceName, testOtelCollector)
exampleJaeger := getJaegerSimpleProd(jaegerInstanceName)
err := fw.Client.Create(goctx.TODO(), exampleJaeger, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")
defer undeployJaegerInstance(exampleJaeger)
Expand All @@ -97,12 +97,12 @@ func (suite *SelfProvisionedTestSuite) TestSelfProvisionedESSmokeTest() {
ProductionSmokeTest(jaegerInstanceName)

// Make sure we were using the correct collector image
verifyCollectorImage(jaegerInstanceName, namespace, testOtelCollector)
verifyCollectorImage(jaegerInstanceName, namespace, specifyOtelImages)
}

func (suite *SelfProvisionedTestSuite) TestIncreasingReplicas() {
jaegerInstanceName := "simple-prod2"
exampleJaeger := getJaegerSimpleProd(jaegerInstanceName, testOtelCollector)
exampleJaeger := getJaegerSimpleProd(jaegerInstanceName)
err := fw.Client.Create(goctx.TODO(), exampleJaeger, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")
defer undeployJaegerInstance(exampleJaeger)
Expand Down Expand Up @@ -183,7 +183,7 @@ func (suite *SelfProvisionedTestSuite) TestIncreasingReplicas() {
ProductionSmokeTest(jaegerInstanceName)

// Make sure we were using the correct collector image
verifyCollectorImage(jaegerInstanceName, namespace, testOtelCollector)
verifyCollectorImage(jaegerInstanceName, namespace, specifyOtelImages)
}

func esDeploymentName(ns, jaegerName string, instances int) string {
Expand Down Expand Up @@ -215,7 +215,7 @@ func (suite *SelfProvisionedTestSuite) TestValidateEsOperatorImage() {
require.Equal(t, expectedEsOperatorImage, imageName)
}

func getJaegerSimpleProd(instanceName string, useOtelCollector bool) *v1.Jaeger {
func getJaegerSimpleProd(instanceName string) *v1.Jaeger {
ingressEnabled := true
exampleJaeger := &v1.Jaeger{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -245,9 +245,12 @@ func getJaegerSimpleProd(instanceName string, useOtelCollector bool) *v1.Jaeger
},
}

if useOtelCollector {
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: 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, testOtelAgent, testOtelAllInOne)
j := createJaegerAgentAsSidecarInstance(jaegerInstanceName, namespace)
defer undeployJaegerInstance(j)

dep := getVertxDefinition(namespace, map[string]string{})
Expand Down
23 changes: 12 additions & 11 deletions test/e2e/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"testing"
"time"

"github.com/sirupsen/logrus"

Expand Down Expand Up @@ -70,10 +71,10 @@ func (suite *SidecarTestSuite) TestSidecar() {
cleanupOptions := &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval}

firstJaegerInstanceName := "agent-as-sidecar"
firstJaegerInstance := createJaegerAgentAsSidecarInstance(firstJaegerInstanceName, namespace, testOtelAgent, testOtelAllInOne)
firstJaegerInstance := createJaegerAgentAsSidecarInstance(firstJaegerInstanceName, namespace)
defer undeployJaegerInstance(firstJaegerInstance)

verifyAllInOneImage(firstJaegerInstanceName, namespace, testOtelAllInOne)
verifyAllInOneImage(firstJaegerInstanceName, namespace, specifyOtelImages)

vertxDeploymentName := "vertx-create-span-sidecar"
dep := getVertxDefinition(vertxDeploymentName, map[string]string{inject.Annotation: "true"})
Expand Down Expand Up @@ -103,7 +104,7 @@ func (suite *SidecarTestSuite) TestSidecar() {

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

persisted := &appsv1.Deployment{}
Expand Down Expand Up @@ -135,7 +136,7 @@ func (suite *SidecarTestSuite) TestSidecar() {
return len(resp.Data) > 0, nil
})
require.NoError(t, err, "Failed waiting for expected content")
verifyAgentImage(vertxDeploymentName, namespace, testOtelAgent)
verifyAgentImage(vertxDeploymentName, namespace, specifyOtelImages)
}

func getVertxDefinition(deploymentName string, annotations map[string]string) *appsv1.Deployment {
Expand Down Expand Up @@ -193,7 +194,7 @@ func getVertxDefinition(deploymentName string, annotations map[string]string) *a
return dep
}

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

j := &v1.Jaeger{
Expand Down Expand Up @@ -224,22 +225,22 @@ func createJaegerAgentAsSidecarInstance(name, namespace string, useOtelAgent, us
},
}

if useOtelAllInOne {
if specifyOtelImages {
logrus.Infof("Using OTEL AllInOne image for %s", name)
j.Spec.AllInOne.Image = otelAllInOneImage
j.Spec.AllInOne.Config = v1.NewFreeForm(getOtelConfigForHealthCheckPort("14269"))
}

if useOtelAgent {
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"))
}

err := fw.Client.Create(goctx.TODO(), j, cleanupOptions)
require.NoError(t, err, "Failed to create jaeger instance")

err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, name, 1, retryInterval, timeout)
err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, name, 1, retryInterval, timeout+1*time.Minute)
require.NoError(t, err, "Error waiting for Jaeger instance deployment")

return j
Expand Down
Loading