Chore: Validate batch query refIds (#63018)

This commit is contained in:
Andres Martinez Gotor
2023-02-09 10:11:16 +01:00
committed by GitHub
parent 2a34293689
commit 00b692c0f9
4 changed files with 36 additions and 2 deletions

View File

@@ -235,6 +235,25 @@ func TestParseMetricRequest(t *testing.T) {
_, err = tc.queryService.parseMetricRequest(httpreq.Context(), tc.signedInUser, true, mr)
require.NoError(t, err)
})
t.Run("Test a duplicated refId", func(t *testing.T) {
tc := setup(t)
mr := metricRequestWithQueries(t, `{
"refId": "A",
"datasource": {
"uid": "gIEkMvIVz",
"type": "postgres"
}
}`, `{
"refId": "A",
"datasource": {
"uid": "gIEkMvIVz",
"type": "postgres"
}
}`)
_, err := tc.queryService.parseMetricRequest(context.Background(), tc.signedInUser, true, mr)
require.Error(t, err)
})
}
func TestQueryDataMultipleSources(t *testing.T) {