MCPcopy Create free account
hub / github.com/zalando/skipper / TestDataClientLoadMetrics

Function TestDataClientLoadMetrics

routing/datasource_test.go:778–807  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

776func (s slowCreateFilter) Response(filters.FilterContext) {}
777
778func TestDataClientLoadMetrics(t *testing.T) {
779 m := &metricstest.MockMetrics{Now: time.Now()}
780
781 dc, err := testdataclient.NewDoc(`r0: * -> <shunt>`)
782 if err != nil {
783 t.Fatal(err)
784 }
785
786 r := routing.New(routing.Options{
787 DataClients: []routing.DataClient{dc},
788 Metrics: m,
789 SignalFirstLoad: true,
790 })
791 defer func() {
792 r.Close()
793 dc.Close()
794 }()
795
796 <-r.FirstLoad()
797
798 // LoadAll ran during the first load.
799 waitForMeasure(t, m, "routes.load_all.unknown")
800
801 // Trigger an update to exercise the LoadUpdate path.
802 if err := dc.UpdateDoc(`r1: * -> <shunt>`, nil); err != nil {
803 t.Fatal(err)
804 }
805
806 waitForMeasure(t, m, "routes.load_update.unknown")
807}
808
809func waitForMeasure(t *testing.T, m *metricstest.MockMetrics, key string) {
810 t.Helper()

Callers

nothing calls this directly

Calls 6

NewDocFunction · 0.92
NewFunction · 0.92
waitForMeasureFunction · 0.85
FirstLoadMethod · 0.80
UpdateDocMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…