From 4829927da1d568e1008b7cf44e12b987bd8007e1 Mon Sep 17 00:00:00 2001 From: Rob Bavey Date: Fri, 21 Apr 2023 18:06:10 -0400 Subject: [PATCH 1/3] Fix Logstash service e2e tests This test was failing, because the readiness probe was hitting the port defined by the service rather than the default port. This commit updates the e2e test to set the config to serve the logtash api from the same port that the service specifies. --- test/e2e/logstash/logstash_test.go | 6 ++++++ test/e2e/test/logstash/builder.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/test/e2e/logstash/logstash_test.go b/test/e2e/logstash/logstash_test.go index 7f56b411b2..f31124e7e1 100644 --- a/test/e2e/logstash/logstash_test.go +++ b/test/e2e/logstash/logstash_test.go @@ -56,6 +56,9 @@ func TestLogstashWithReworkedApiService(t *testing.T) { } logstashBuilder := (logstash.NewBuilder(name). WithNodeCount(1). + WithConfig(map[string]interface{}{ + "api.http.port": 9200, + }). WithServices(service)) test.Sequence(nil, test.EmptySteps, logstashBuilder).RunSequential(t) @@ -87,6 +90,9 @@ func TestLogstashWithCustomServiceAndAmendedApi(t *testing.T) { logstashBuilder := (logstash.NewBuilder(name). WithNodeCount(1). + WithConfig(map[string]interface{}{ + "api.http.port": 9601, + }). WithServices(apiService, customService)) test.Sequence(nil, test.EmptySteps, logstashBuilder).RunSequential(t) diff --git a/test/e2e/test/logstash/builder.go b/test/e2e/test/logstash/builder.go index 07d0ee21de..74482e8da4 100644 --- a/test/e2e/test/logstash/builder.go +++ b/test/e2e/test/logstash/builder.go @@ -161,6 +161,14 @@ func (b Builder) GetMetricsIndexPattern() string { return ".monitoring-logstash-8-mb" } +func (b Builder) WithConfig(config map[string]interface{}) Builder { + b.Logstash.Spec.Config = &commonv1.Config{ + Data: config, + } + + return b +} + func (b Builder) Name() string { return b.Logstash.Name } From 736de05884cb289d9020cff0605644cba24beef4 Mon Sep 17 00:00:00 2001 From: Rob Bavey Date: Mon, 24 Apr 2023 09:14:26 -0400 Subject: [PATCH 2/3] Update test/e2e/test/logstash/builder.go Co-authored-by: Michael Morello --- test/e2e/test/logstash/builder.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/e2e/test/logstash/builder.go b/test/e2e/test/logstash/builder.go index 74482e8da4..f0d197b497 100644 --- a/test/e2e/test/logstash/builder.go +++ b/test/e2e/test/logstash/builder.go @@ -165,7 +165,6 @@ func (b Builder) WithConfig(config map[string]interface{}) Builder { b.Logstash.Spec.Config = &commonv1.Config{ Data: config, } - return b } From da146c59b36e460d5cb206667f72cefe536cddfa Mon Sep 17 00:00:00 2001 From: Rob Bavey Date: Mon, 24 Apr 2023 09:19:37 -0400 Subject: [PATCH 3/3] Add comments to Logstash e2e tests --- test/e2e/logstash/logstash_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/e2e/logstash/logstash_test.go b/test/e2e/logstash/logstash_test.go index f31124e7e1..55b1276b5a 100644 --- a/test/e2e/logstash/logstash_test.go +++ b/test/e2e/logstash/logstash_test.go @@ -42,6 +42,7 @@ func TestLogstashWithCustomService(t *testing.T) { test.Sequence(nil, test.EmptySteps, logstashBuilder).RunSequential(t) } +// This test sets a custom port for the Logstash API service func TestLogstashWithReworkedApiService(t *testing.T) { name := "test-multiple-custom-logstash" service := logstashv1alpha1.LogstashService{ @@ -56,6 +57,7 @@ func TestLogstashWithReworkedApiService(t *testing.T) { } logstashBuilder := (logstash.NewBuilder(name). WithNodeCount(1). + // Change the Logstash API service port WithConfig(map[string]interface{}{ "api.http.port": 9200, }). @@ -64,6 +66,7 @@ func TestLogstashWithReworkedApiService(t *testing.T) { test.Sequence(nil, test.EmptySteps, logstashBuilder).RunSequential(t) } +// This test adds a new service, and changes the port that the logstash API is served from func TestLogstashWithCustomServiceAndAmendedApi(t *testing.T) { name := "test-multiple-custom-logstash" customService := logstashv1alpha1.LogstashService{ @@ -90,6 +93,7 @@ func TestLogstashWithCustomServiceAndAmendedApi(t *testing.T) { logstashBuilder := (logstash.NewBuilder(name). WithNodeCount(1). + // Change the Logstash API service port WithConfig(map[string]interface{}{ "api.http.port": 9601, }).