From 66ef1f9888306f76381d232795e95d8732362fce Mon Sep 17 00:00:00 2001 From: joeyyy09 Date: Fri, 19 Jul 2024 17:03:58 +0530 Subject: [PATCH] fix merge conflicts Signed-off-by: joeyyy09 --- .../internal/integration/e2e_integration.go | 37 ++++++++++++++----- .../integration/e2e_integration_test.go | 4 +- .../internal/integration/memory_test.go | 2 +- jaeger-ui | 2 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index cf590fbab3f..f399e696095 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -127,22 +127,41 @@ func (s *E2EStorageIntegration) e2eCleanUp(t *testing.T) { func createStorageCleanerConfig(t *testing.T, configFile string, storage string, injectStorageCleaner bool) string { data, err := os.ReadFile(configFile) require.NoError(t, err) + var config map[string]any err = yaml.Unmarshal(data, &config) require.NoError(t, err) - serviceAny, ok := config["service"] + // Ensure extensions are correctly parsed before any modifications + extensionsAny, ok := config["extensions"] require.True(t, ok) - service := serviceAny.(map[string]any) - service["extensions"] = append(service["extensions"].([]any), "storage_cleaner") + extensions := extensionsAny.(map[string]any) - extensions, ok := config["extensions"].(map[string]any) - require.True(t, ok) - query, ok := extensions["jaeger_query"].(map[string]any) - require.True(t, ok) - trace_storage := query["trace_storage"].(string) - extensions["storage_cleaner"] = map[string]string{"trace_storage": trace_storage} + if injectStorageCleaner{ + // Add storage_cleaner to the service extensions + serviceAny, ok := config["service"] + require.True(t, ok) + service := serviceAny.(map[string]any) + + // Ensure the extensions key is present and is a slice + if extList, ok := service["extensions"].([]any); ok { + service["extensions"] = append(extList, "storage_cleaner") + } else { + service["extensions"] = []any{"storage_cleaner"} + } + + // Ensure jaeger_query is correctly parsed + queryAny, ok := extensions["jaeger_query"] + require.True(t, ok) + query := queryAny.(map[string]any) + trace_storage, ok := query["trace_storage"].(string) + require.True(t, ok) + + extensions["storage_cleaner"] = map[string]string{"trace_storage": trace_storage} + } + + // Ensure jaeger_storage is correctly parsed jaegerStorageAny, ok := extensions["jaeger_storage"] require.True(t, ok) jaegerStorage := jaegerStorageAny.(map[string]any) diff --git a/cmd/jaeger/internal/integration/e2e_integration_test.go b/cmd/jaeger/internal/integration/e2e_integration_test.go index a6aaca13623..adaa8031c22 100644 --- a/cmd/jaeger/internal/integration/e2e_integration_test.go +++ b/cmd/jaeger/internal/integration/e2e_integration_test.go @@ -8,6 +8,6 @@ import "testing" func TestCreateStorageCleanerConfig(t *testing.T) { // Ensure that we can parse the existing configs correctly. // This is faster to run than the full integration test. - createStorageCleanerConfig(t, "../../config-elasticsearch.yaml", "elasticsearch") - createStorageCleanerConfig(t, "../../config-opensearch.yaml", "opensearch") + createStorageCleanerConfig(t, "../../config-elasticsearch.yaml", "elasticsearch", true) + createStorageCleanerConfig(t, "../../config-opensearch.yaml", "opensearch", true) } diff --git a/cmd/jaeger/internal/integration/memory_test.go b/cmd/jaeger/internal/integration/memory_test.go index a2592b04a38..9c1b628cf7a 100644 --- a/cmd/jaeger/internal/integration/memory_test.go +++ b/cmd/jaeger/internal/integration/memory_test.go @@ -19,7 +19,7 @@ func TestMemoryStorage(t *testing.T) { CleanUp: purge, }, } - s.e2eInitialize(t, "memory") + s.e2eInitialize(t, "memory", true) t.Cleanup(func() { s.e2eCleanUp(t) }) diff --git a/jaeger-ui b/jaeger-ui index 1704a9a66ae..560c749b481 160000 --- a/jaeger-ui +++ b/jaeger-ui @@ -1 +1 @@ -Subproject commit 1704a9a66ae780ec6bb2f524116176aa9c8a23f8 +Subproject commit 560c749b481f8244bf76b0afe001174fa9ce11f5