MCPcopy Create free account
hub / github.com/facebook/time / TestFetchStatsWithIngressTime

Function TestFetchStatsWithIngressTime

fbclock/daemon/datafetcher_http_test.go:141–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139 surl, err := url.Parse(ts.URL)
140 require.NoError(t, err)
141 cfg := &Config{PTPClientAddress: fmt.Sprintf("%s:%s", surl.Hostname(), surl.Port())}
142 fetcher := &HTTPFetcher{}
143 _, err = fetcher.FetchStats(cfg)
144 require.EqualError(
145 t,
146 err,
147 `no selected grandmaster out of 4 reported by sptp: [`+
148 `127.0.0.1 error="timed out waiting for response" cf_rx=0 cf_tx=0 clock_class=0 clock_accuracy=0, `+
149 `127.0.0.2 error="" cf_rx=-250 cf_tx=100 clock_class=6 clock_accuracy=33, `+
150 `127.0.0.3 error="" cf_rx=0 cf_tx=0 clock_class=248 clock_accuracy=254, `+
151 `127.0.0.4 error="" cf_rx=0 cf_tx=0 clock_class=248 clock_accuracy=49]`,
152 )
153}
154
155func TestFetchStatsNoGMsReported(t *testing.T) {
156 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
157 fmt.Fprintln(w, `[]`)
158 }))
159 defer ts.Close()
160 surl, err := url.Parse(ts.URL)
161 require.NoError(t, err)
162 cfg := &Config{PTPClientAddress: fmt.Sprintf("%s:%s", surl.Hostname(), surl.Port())}
163 fetcher := &HTTPFetcher{}
164 _, err = fetcher.FetchStats(cfg)

Callers

nothing calls this directly

Calls 2

FetchStatsMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…