@@ -104,7 +104,13 @@ func TestIngestOTLP(t *testing.T) {
104104 err = os .WriteFile (pprofDumpFileName , pprof , 0644 )
105105 assert .NoError (t , err )
106106
107- expectedBytes , err := os .ReadFile (metric .expectedJsonPath )
107+ // Use different expected output files for v1 and v2
108+ expectedPath := metric .expectedJsonPath
109+ if p .config .LimitsConfig .ReadPathOverrides .EnableQueryBackend {
110+ expectedPath = strings .ReplaceAll (expectedPath , ".out.json" , ".out.v2.json" )
111+ }
112+
113+ expectedBytes , err := os .ReadFile (expectedPath )
108114 require .NoError (t , err )
109115 var expected strprofile.CompactProfile
110116 assert .NoError (t , json .Unmarshal (expectedBytes , & expected ))
@@ -211,7 +217,13 @@ func TestIngestOTLPHTTPBinary(t *testing.T) {
211217 actualBytes , err := json .Marshal (actual )
212218 assert .NoError (t , err )
213219
214- expectedBytes , err := os .ReadFile (metric .expectedJsonPath )
220+ // Use different expected output files for v1 and v2
221+ expectedPath := metric .expectedJsonPath
222+ if p .config .LimitsConfig .ReadPathOverrides .EnableQueryBackend {
223+ expectedPath = strings .ReplaceAll (expectedPath , ".out.json" , ".out.v2.json" )
224+ }
225+
226+ expectedBytes , err := os .ReadFile (expectedPath )
215227 require .NoError (t , err )
216228 var expected strprofile.CompactProfile
217229 assert .NoError (t , json .Unmarshal (expectedBytes , & expected ))
@@ -281,7 +293,13 @@ func TestIngestOTLPHTTPJSON(t *testing.T) {
281293 actualBytes , err := json .Marshal (actual )
282294 assert .NoError (t , err )
283295
284- expectedBytes , err := os .ReadFile (metric .expectedJsonPath )
296+ // Use different expected output files for v1 and v2
297+ expectedPath := metric .expectedJsonPath
298+ if p .config .LimitsConfig .ReadPathOverrides .EnableQueryBackend {
299+ expectedPath = strings .ReplaceAll (expectedPath , ".out.json" , ".out.v2.json" )
300+ }
301+
302+ expectedBytes , err := os .ReadFile (expectedPath )
285303 require .NoError (t , err )
286304 var expected strprofile.CompactProfile
287305 assert .NoError (t , json .Unmarshal (expectedBytes , & expected ))
0 commit comments