Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv committed Sep 19, 2024
1 parent fc1bd62 commit 40998c5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 99 deletions.
2 changes: 1 addition & 1 deletion extension/healthcheckextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestLoadConfig(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, sub.Unmarshal(cfg))
require.NoError(t, component.UnmarshalConfig(sub, cfg))
if tt.expectedErr != nil {
assert.ErrorIs(t, component.ValidateConfig(cfg), tt.expectedErr)
return
Expand Down
43 changes: 0 additions & 43 deletions extension/healthcheckextension/healthcheckextension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,11 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
ResponseBody: nil,
},
teststeps: []teststep{
{
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: expectedBodyNotReady,
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.Ready() },
expectedStatusCode: http.StatusOK,
expectedBody: expectedBodyReady,
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.NotReady() },
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: expectedBodyNotReady,
},
},
},
{
Expand All @@ -80,17 +71,10 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
Path: "/health",
},
teststeps: []teststep{
{
expectedStatusCode: http.StatusServiceUnavailable,
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.Ready() },
expectedStatusCode: http.StatusOK,
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.NotReady() },
expectedStatusCode: http.StatusServiceUnavailable,
},
},
},
{
Expand All @@ -104,20 +88,11 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
ResponseBody: &ResponseBodySettings{Healthy: "ALL OK", Unhealthy: "NOT OK"},
},
teststeps: []teststep{
{
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "NOT OK",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.Ready() },
expectedStatusCode: http.StatusOK,
expectedBody: "ALL OK",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.NotReady() },
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "NOT OK",
},
},
},
{
Expand All @@ -131,20 +106,11 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
ResponseBody: &ResponseBodySettings{Healthy: "ALL OK"},
},
teststeps: []teststep{
{
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.Ready() },
expectedStatusCode: http.StatusOK,
expectedBody: "ALL OK",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.NotReady() },
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "",
},
},
},
{
Expand All @@ -158,20 +124,11 @@ func TestHealthCheckExtensionUsage(t *testing.T) {
ResponseBody: &ResponseBodySettings{Unhealthy: "NOT OK"},
},
teststeps: []teststep{
{
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "NOT OK",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.Ready() },
expectedStatusCode: http.StatusOK,
expectedBody: "",
},
{
step: func(hcExt *healthCheckExtension) error { return hcExt.NotReady() },
expectedStatusCode: http.StatusServiceUnavailable,
expectedBody: "NOT OK",
},
},
},
}
Expand Down
50 changes: 0 additions & 50 deletions extension/healthcheckextension/integration_test.go

This file was deleted.

10 changes: 5 additions & 5 deletions extension/healthcheckextension/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
health_check:
health_check/1:
signoz_health_check:
signoz_health_check/1:
endpoint: "localhost:13"
tls:
ca_file: "/path/to/ca"
Expand All @@ -9,19 +9,19 @@ health_check/1:
enabled: false
interval: "5m"
exporter_failure_threshold: 5
health_check/missingendpoint:
signoz_health_check/missingendpoint:
endpoint: ""
check_collector_pipeline:
enabled: false
interval: "5m"
exporter_failure_threshold: 5
health_check/invalidthreshold:
signoz_health_check/invalidthreshold:
endpoint: "localhost:13"
check_collector_pipeline:
enabled: false
interval: "5m"
exporter_failure_threshold: -1
health_check/invalidpath:
signoz_health_check/invalidpath:
endpoint: "localhost:13"
path: "invalid"
check_collector_pipeline:
Expand Down

0 comments on commit 40998c5

Please sign in to comment.