diff --git a/test/e2e/sidecar_test.go b/test/e2e/sidecar_test.go index 2b690cc8fb..e1594b2244 100644 --- a/test/e2e/sidecar_test.go +++ b/test/e2e/sidecar_test.go @@ -16,6 +16,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" @@ -99,6 +100,42 @@ func (suite *SidecarTestSuite) TestSidecar() { return len(resp.Data) > 0, nil }) require.NoError(t, err, "Failed waiting for expected content") + + /* Testing other instance */ + + otherJaegerInstanceName := "agent-as-sidecar2" + j2 := getJaegerAgentAsSidecarDefinition(otherJaegerInstanceName, namespace) + err = fw.Client.Create(goctx.TODO(), j2, cleanupOptions) + err = e2eutil.WaitForDeployment(t, fw.KubeClient, namespace, jaegerInstanceName, 1, retryInterval, timeout) + require.NoError(t, err, "Error waiting for Jaeger instance deployment") + + persisted := &appsv1.Deployment{} + err = fw.Client.Get(goctx.TODO(), types.NamespacedName{ + Name: "vertx-create-span-sidecar", + Namespace: namespace, + }, persisted) + require.NoError(t, err, "Error getting jaeger instance") + require.Equal(t, "agent-as-sidecar", persisted.Labels[inject.Label]) + + fw.Client.Delete(goctx.TODO(), j) + + url, httpClient := getQueryURLAndHTTPClient(otherJaegerInstanceName, "%s/api/traces?service=order", true) + req, err := http.NewRequest(http.MethodGet, url, nil) + + err = wait.Poll(retryInterval, timeout, func() (done bool, err error) { + res, err := httpClient.Do(req) + require.NoError(t, err) + + body, err := ioutil.ReadAll(res.Body) + require.NoError(t, err) + + resp := &resp{} + err = json.Unmarshal(body, &resp) + require.NoError(t, err) + + return len(resp.Data) > 0, nil + }) + require.NoError(t, err, "Failed waiting for expected content") } func getVertxDefinition(annotations map[string]string) *appsv1.Deployment {