MCPcopy
hub / github.com/nakabonne/ali / TestFileExporter_NaNInf

Function TestFileExporter_NaNInf

export/export_test.go:149–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func 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
175func TestFileExporter_AppendsRuns(t *testing.T) {
176 dir := t.TempDir()

Callers

nothing calls this directly

Calls 6

StartRunMethod · 0.95
NewFileExporterFunction · 0.85
readGoldenFunction · 0.85
readFileFunction · 0.85
WriteResultMethod · 0.80
CloseMethod · 0.80

Tested by

no test coverage detected