@@ -13,7 +13,6 @@ import (
13
13
"os"
14
14
"os/exec"
15
15
"path/filepath"
16
- "strings"
17
16
"testing"
18
17
"time"
19
18
@@ -42,10 +41,10 @@ const otlpPort = 4317
42
41
type E2EStorageIntegration struct {
43
42
integration.StorageIntegration
44
43
45
- SkipStorageCleaner bool
46
- ConfigFile string
47
- BinaryName string
48
- HealthCheckEndpoint string
44
+ SkipStorageCleaner bool
45
+ ConfigFile string
46
+ BinaryName string
47
+ HealthCheckPort int // overridable for Kafka tests which run two binaries and need different ports
49
48
50
49
// EnvVarOverrides contains a map of environment variables to set.
51
50
// The key in the map is the environment variable to override and the value
@@ -160,10 +159,11 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) {
160
159
}
161
160
162
161
func (s * E2EStorageIntegration ) doHealthCheck (t * testing.T ) bool {
163
- healthCheckEndpoint := s .HealthCheckEndpoint
164
- if healthCheckEndpoint == "" {
165
- healthCheckEndpoint = "http://localhost:13133/status"
162
+ healthCheckPort := s .HealthCheckPort
163
+ if healthCheckPort == 0 {
164
+ healthCheckPort = ports . CollectorV2HealthChecks
166
165
}
166
+ healthCheckEndpoint := fmt .Sprintf ("http://localhost:%d/status" , healthCheckPort )
167
167
t .Logf ("Checking if %s is available on %s" , s .BinaryName , healthCheckEndpoint )
168
168
ctx , cancel := context .WithTimeout (context .Background (), 3 * time .Second )
169
169
defer cancel ()
@@ -187,11 +187,6 @@ func (s *E2EStorageIntegration) doHealthCheck(t *testing.T) bool {
187
187
t .Logf ("HTTP response not OK: %v" , string (body ))
188
188
return false
189
189
}
190
- // for backwards compatibility with other healthchecks
191
- if ! strings .HasSuffix (healthCheckEndpoint , "/status" ) {
192
- t .Logf ("OK HTTP from endpoint that is not healthcheckv2" )
193
- return true
194
- }
195
190
196
191
var healthResponse struct {
197
192
Status string `json:"status"`
@@ -203,7 +198,7 @@ func (s *E2EStorageIntegration) doHealthCheck(t *testing.T) bool {
203
198
204
199
// Check if the status field in the JSON is "StatusOK"
205
200
if healthResponse .Status != "StatusOK" {
206
- t .Logf ("Received non-K status %s: %s" , healthResponse .Status , string (body ))
201
+ t .Logf ("Received non-OK status %s: %s" , healthResponse .Status , string (body ))
207
202
return false
208
203
}
209
204
return true
0 commit comments