(t *testing.T)
| 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 | |
| 155 | func 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…