Jaeger: Run dependency graph queries through backend behind the feature toggle (#103768)
* Start with dependency graph * Update and add tests * Fix lint and ordering in test
This commit is contained in:
@@ -184,3 +184,97 @@ func TestTransformTraceResponse(t *testing.T) {
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "complex_trace.golden", frame, false)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTransformDependenciesResponse(t *testing.T) {
|
||||
t.Run("simple_dependencies", func(t *testing.T) {
|
||||
dependencies := DependenciesResponse{
|
||||
Data: []ServiceDependency{
|
||||
{
|
||||
Parent: "serviceA",
|
||||
Child: "serviceB",
|
||||
CallCount: 1,
|
||||
},
|
||||
{
|
||||
Parent: "serviceA",
|
||||
Child: "serviceC",
|
||||
CallCount: 2,
|
||||
},
|
||||
{
|
||||
Parent: "serviceB",
|
||||
Child: "serviceC",
|
||||
CallCount: 3,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
frames := transformDependenciesResponse(dependencies, "test")
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "simple_dependencies_nodes.golden", frames[0], false)
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "simple_dependencies_edges.golden", frames[1], false)
|
||||
})
|
||||
|
||||
t.Run("empty_dependencies", func(t *testing.T) {
|
||||
dependencies := DependenciesResponse{
|
||||
Data: []ServiceDependency{},
|
||||
}
|
||||
|
||||
frames := transformDependenciesResponse(dependencies, "test")
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "empty_dependencies_nodes.golden", frames[0], false)
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "empty_dependencies_edges.golden", frames[1], false)
|
||||
})
|
||||
|
||||
t.Run("complex_dependencies", func(t *testing.T) {
|
||||
dependencies := DependenciesResponse{
|
||||
Data: []ServiceDependency{
|
||||
{
|
||||
Parent: "frontend",
|
||||
Child: "auth-service",
|
||||
CallCount: 150,
|
||||
},
|
||||
{
|
||||
Parent: "frontend",
|
||||
Child: "api-gateway",
|
||||
CallCount: 300,
|
||||
},
|
||||
{
|
||||
Parent: "api-gateway",
|
||||
Child: "user-service",
|
||||
CallCount: 200,
|
||||
},
|
||||
{
|
||||
Parent: "api-gateway",
|
||||
Child: "order-service",
|
||||
CallCount: 100,
|
||||
},
|
||||
{
|
||||
Parent: "order-service",
|
||||
Child: "payment-service",
|
||||
CallCount: 80,
|
||||
},
|
||||
{
|
||||
Parent: "order-service",
|
||||
Child: "inventory-service",
|
||||
CallCount: 90,
|
||||
},
|
||||
{
|
||||
Parent: "user-service",
|
||||
Child: "database",
|
||||
CallCount: 500,
|
||||
},
|
||||
{
|
||||
Parent: "payment-service",
|
||||
Child: "database",
|
||||
CallCount: 200,
|
||||
},
|
||||
{
|
||||
Parent: "inventory-service",
|
||||
Child: "database",
|
||||
CallCount: 300,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
frames := transformDependenciesResponse(dependencies, "test")
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "complex_dependencies_nodes.golden", frames[0], false)
|
||||
experimental.CheckGoldenJSONFrame(t, "./testdata", "complex_dependencies_edges.golden", frames[1], false)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user