Skip to content

Commit fbfe8f3

Browse files
committed
add v2 specific tesdata json output file
1 parent 765d55e commit fbfe8f3

File tree

4 files changed

+1806
-4
lines changed

4 files changed

+1806
-4
lines changed

pkg/ingester/otlp/testdata/TestSampleAttributes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
"time_nanos": "239",
3939
"duration_nanos": "10000000000",
4040
"period": "0"
41-
}
41+
}

pkg/test/integration/ingest_otlp_test.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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))

pkg/test/integration/testdata/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ index bf7a6612f..1a6619243 100644
109109
+}
110110
```
111111
2.Launch local pyroscope instance
112+
112113
3.Compile & start ebpf profiler with following parameters:
113114

114115
```

0 commit comments

Comments
 (0)