(cherry picked from commit 64d93498de)
This commit is contained in:
@@ -37,10 +37,10 @@ func TestMatrixResponses(t *testing.T) {
|
||||
enableWideSeries := false
|
||||
queryFileName := filepath.Join("../testdata", test.filepath+".query.json")
|
||||
responseFileName := filepath.Join("../testdata", test.filepath+".result.json")
|
||||
goldenFileName := filepath.Join("../testdata", test.filepath+".result.streaming.golden")
|
||||
goldenFileName := test.filepath + ".result.streaming.golden"
|
||||
t.Run(test.name, goldenScenario(test.name, queryFileName, responseFileName, goldenFileName, enableWideSeries))
|
||||
enableWideSeries = true
|
||||
goldenFileName = filepath.Join("../testdata", test.filepath+".result.streaming-wide.golden")
|
||||
goldenFileName = test.filepath + ".result.streaming-wide.golden"
|
||||
t.Run(test.name, goldenScenario(test.name, queryFileName, responseFileName, goldenFileName, enableWideSeries))
|
||||
}
|
||||
}
|
||||
@@ -60,20 +60,7 @@ func goldenScenario(name, queryFileName, responseFileName, goldenFileName string
|
||||
dr, found := result.Responses["A"]
|
||||
require.True(t, found)
|
||||
|
||||
actual, err := json.MarshalIndent(&dr, "", " ")
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:gosec
|
||||
// We can ignore the gosec G304 because this is a test with static defined paths
|
||||
expected, err := ioutil.ReadFile(goldenFileName + ".json")
|
||||
if err != nil || update {
|
||||
err = os.WriteFile(goldenFileName+".json", actual, 0600)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
require.JSONEq(t, string(expected), string(actual))
|
||||
|
||||
require.NoError(t, experimental.CheckGoldenDataResponse(goldenFileName+".txt", &dr, update))
|
||||
experimental.CheckGoldenJSONResponse(t, "../testdata", goldenFileName, &dr, update)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user