MCPcopy Create free account
hub / github.com/google/pprof / TestCompatibilizeSampleTypes

Function TestCompatibilizeSampleTypes

profile/merge_test.go:227–446  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

225}
226
227func TestCompatibilizeSampleTypes(t *testing.T) {
228 for _, tc := range []struct {
229 desc string
230 ps []*Profile
231 want []*Profile
232 wantError bool
233 }{
234 {
235 desc: "drop first sample types",
236 ps: []*Profile{
237 {
238 DefaultSampleType: "delete1",
239 SampleType: []*ValueType{
240 {Type: "delete1", Unit: "Unit1"},
241 {Type: "delete2", Unit: "Unit2"},
242 {Type: "keep1", Unit: "Unit3"},
243 {Type: "keep2", Unit: "Unit4"},
244 {Type: "keep3", Unit: "Unit5"},
245 },
246 Sample: []*Sample{
247 {Value: []int64{1, 2, 3, 4, 5}},
248 {Value: []int64{10, 20, 30, 40, 50}},
249 },
250 },
251 {
252 DefaultSampleType: "keep1",
253 SampleType: []*ValueType{
254 {Type: "keep1", Unit: "Unit3"},
255 {Type: "keep2", Unit: "Unit4"},
256 {Type: "keep3", Unit: "Unit5"},
257 },
258 Sample: []*Sample{
259 {Value: []int64{1, 2, 3}},
260 {Value: []int64{10, 20, 30}},
261 },
262 },
263 },
264 want: []*Profile{
265 {
266 DefaultSampleType: "keep1",
267 SampleType: []*ValueType{
268 {Type: "keep1", Unit: "Unit3"},
269 {Type: "keep2", Unit: "Unit4"},
270 {Type: "keep3", Unit: "Unit5"},
271 },
272 Sample: []*Sample{
273 {Value: []int64{3, 4, 5}},
274 {Value: []int64{30, 40, 50}},
275 },
276 },
277 {
278 DefaultSampleType: "keep1",
279 SampleType: []*ValueType{
280 {Type: "keep1", Unit: "Unit3"},
281 {Type: "keep2", Unit: "Unit4"},
282 {Type: "keep3", Unit: "Unit5"},
283 },
284 Sample: []*Sample{

Callers

nothing calls this directly

Calls 3

DiffFunction · 0.92
CompatibilizeSampleTypesFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…