(t *testing.T)
| 1400 | } |
| 1401 | |
| 1402 | func TestSetNumLabel(t *testing.T) { |
| 1403 | var testcases = []struct { |
| 1404 | desc string |
| 1405 | samples []*Sample |
| 1406 | setKey string |
| 1407 | setVal []int64 |
| 1408 | setUnit []string |
| 1409 | wantValues []map[string][]int64 |
| 1410 | wantUnits []map[string][]string |
| 1411 | }{ |
| 1412 | { |
| 1413 | desc: "some samples have label already", |
| 1414 | samples: []*Sample{ |
| 1415 | { |
| 1416 | Location: []*Location{cpuL[0]}, |
| 1417 | Value: []int64{1000}, |
| 1418 | }, |
| 1419 | { |
| 1420 | Location: []*Location{cpuL[0]}, |
| 1421 | Value: []int64{1000}, |
| 1422 | NumLabel: map[string][]int64{ |
| 1423 | "key1": {1, 2, 3}, |
| 1424 | "key2": {1}, |
| 1425 | }, |
| 1426 | NumUnit: map[string][]string{ |
| 1427 | "key1": {"bytes", "bytes", "bytes"}, |
| 1428 | "key2": {"gallons"}, |
| 1429 | }, |
| 1430 | }, |
| 1431 | { |
| 1432 | Location: []*Location{cpuL[0]}, |
| 1433 | Value: []int64{1000}, |
| 1434 | NumLabel: map[string][]int64{ |
| 1435 | "key1": {2}, |
| 1436 | }, |
| 1437 | NumUnit: map[string][]string{ |
| 1438 | "key1": {"volts"}, |
| 1439 | }, |
| 1440 | }, |
| 1441 | }, |
| 1442 | setKey: "key1", |
| 1443 | setVal: []int64{1}, |
| 1444 | setUnit: []string{"bytes"}, |
| 1445 | wantValues: []map[string][]int64{ |
| 1446 | {"key1": {1}}, |
| 1447 | {"key1": {1}, "key2": {1}}, |
| 1448 | {"key1": {1}}, |
| 1449 | }, |
| 1450 | wantUnits: []map[string][]string{ |
| 1451 | {"key1": {"bytes"}}, |
| 1452 | {"key1": {"bytes"}, "key2": {"gallons"}}, |
| 1453 | {"key1": {"bytes"}}, |
| 1454 | }, |
| 1455 | }, |
| 1456 | { |
| 1457 | desc: "no samples have labels", |
| 1458 | samples: []*Sample{ |
| 1459 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…