Skip to content

Commit

Permalink
Add more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-osborn committed Jan 27, 2025
1 parent 3d25776 commit b916e8c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions internal/mode/static/state/dataplane/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3256,6 +3256,11 @@ func TestBuildTelemetry(t *testing.T) {
msg string
expTelemetry Telemetry
}{
{
g: &graph.Graph{},
expTelemetry: Telemetry{},
msg: "nil Gateway",
},
{
g: &graph.Graph{
Gateway: &graph.Gateway{
Expand All @@ -3274,6 +3279,52 @@ func TestBuildTelemetry(t *testing.T) {
expTelemetry: Telemetry{},
msg: "No telemetry configured",
},
{
g: &graph.Graph{
Gateway: &graph.Gateway{
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
Telemetry: &ngfAPIv1alpha2.Telemetry{
Exporter: &ngfAPIv1alpha2.TelemetryExporter{
Endpoint: helpers.GetPointer("my-otel.svc:4563"),
},
DisabledFeatures: []ngfAPIv1alpha2.DisableTelemetryFeature{
ngfAPIv1alpha2.DisableTracing,
},
},
},
},
},
expTelemetry: Telemetry{},
msg: "Telemetry disabled explicitly",
},
{
g: &graph.Graph{
Gateway: &graph.Gateway{
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
Telemetry: &ngfAPIv1alpha2.Telemetry{
Exporter: nil,
},
},
},
},
expTelemetry: Telemetry{},
msg: "Telemetry disabled implicitly (nil exporter)",
},
{
g: &graph.Graph{
Gateway: &graph.Gateway{
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
Telemetry: &ngfAPIv1alpha2.Telemetry{
Exporter: &ngfAPIv1alpha2.TelemetryExporter{
Endpoint: nil,
},
},
},
},
},
expTelemetry: Telemetry{},
msg: "Telemetry disabled implicitly (nil exporter endpoint)",
},
{
g: &graph.Graph{
Gateway: &graph.Gateway{
Expand Down

0 comments on commit b916e8c

Please sign in to comment.