(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestFileExporter_NaNInf(t *testing.T) { |
| 150 | dir := t.TempDir() |
| 151 | exporter := NewFileExporter(dir) |
| 152 | zone := time.FixedZone("JST", 9*60*60) |
| 153 | |
| 154 | run, err := exporter.StartRun(Meta{ |
| 155 | ID: "22222222-2222-2222-2222-222222222222", |
| 156 | TargetURL: "https://example.com/", |
| 157 | Method: "GET", |
| 158 | Rate: 1, |
| 159 | Duration: time.Second, |
| 160 | }) |
| 161 | require.NoError(t, err) |
| 162 | |
| 163 | require.NoError(t, run.WriteResult(Result{ |
| 164 | Timestamp: time.Date(2021, 3, 13, 15, 20, 43, 0, zone), |
| 165 | LatencyNS: math.NaN(), |
| 166 | StatusCode: 200, |
| 167 | })) |
| 168 | require.NoError(t, run.Close(Summary{})) |
| 169 | |
| 170 | wantResults := readGolden(t, filepath.Join("..", "testdata", "export", "naninf", "results.csv")) |
| 171 | gotResults := readFile(t, filepath.Join(dir, resultsFilename)) |
| 172 | require.Equal(t, string(wantResults), string(gotResults)) |
| 173 | } |
| 174 | |
| 175 | func TestFileExporter_AppendsRuns(t *testing.T) { |
| 176 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected