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

Function TestSetLabel

profile/profile_test.go:1269–1400  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1267}
1268
1269func TestSetLabel(t *testing.T) {
1270 var testcases = []struct {
1271 desc string
1272 samples []*Sample
1273 setKey string
1274 setVal []string
1275 wantLabels []map[string][]string
1276 }{
1277 {
1278 desc: "some samples have label already",
1279 samples: []*Sample{
1280 {
1281 Location: []*Location{cpuL[0]},
1282 Value: []int64{1000},
1283 },
1284 {
1285 Location: []*Location{cpuL[0]},
1286 Value: []int64{1000},
1287 Label: map[string][]string{
1288 "key1": {"value1", "value2", "value3"},
1289 "key2": {"value1"},
1290 },
1291 },
1292 {
1293 Location: []*Location{cpuL[0]},
1294 Value: []int64{1000},
1295 Label: map[string][]string{
1296 "key1": {"value2"},
1297 },
1298 },
1299 },
1300 setKey: "key1",
1301 setVal: []string{"value1"},
1302 wantLabels: []map[string][]string{
1303 {"key1": {"value1"}},
1304 {"key1": {"value1"}, "key2": {"value1"}},
1305 {"key1": {"value1"}},
1306 },
1307 },
1308 {
1309 desc: "no samples have labels",
1310 samples: []*Sample{
1311 {
1312 Location: []*Location{cpuL[0]},
1313 Value: []int64{1000},
1314 },
1315 },
1316 setKey: "key1",
1317 setVal: []string{"value1"},
1318 wantLabels: []map[string][]string{
1319 {"key1": {"value1"}},
1320 },
1321 },
1322 {
1323 desc: "all samples have some labels, but not key being added",
1324 samples: []*Sample{
1325 {
1326 Location: []*Location{cpuL[0]},

Callers

nothing calls this directly

Calls 2

CopyMethod · 0.80
SetLabelMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…