(t *testing.T)
| 1592 | } |
| 1593 | |
| 1594 | func TestRemoveNumLabel(t *testing.T) { |
| 1595 | var testcases = []struct { |
| 1596 | desc string |
| 1597 | samples []*Sample |
| 1598 | removeKey string |
| 1599 | wantValues []map[string][]int64 |
| 1600 | wantUnits []map[string][]string |
| 1601 | }{ |
| 1602 | { |
| 1603 | desc: "some samples have label already", |
| 1604 | samples: []*Sample{ |
| 1605 | { |
| 1606 | Location: []*Location{cpuL[0]}, |
| 1607 | Value: []int64{1000}, |
| 1608 | }, |
| 1609 | { |
| 1610 | Location: []*Location{cpuL[0]}, |
| 1611 | Value: []int64{1000}, |
| 1612 | NumLabel: map[string][]int64{ |
| 1613 | "key1": {1, 2, 3}, |
| 1614 | "key2": {1}, |
| 1615 | }, |
| 1616 | NumUnit: map[string][]string{ |
| 1617 | "key1": {"foo", "bar", "baz"}, |
| 1618 | "key2": {"seconds"}, |
| 1619 | }, |
| 1620 | }, |
| 1621 | { |
| 1622 | Location: []*Location{cpuL[0]}, |
| 1623 | Value: []int64{1000}, |
| 1624 | NumLabel: map[string][]int64{ |
| 1625 | "key1": {2}, |
| 1626 | }, |
| 1627 | NumUnit: map[string][]string{ |
| 1628 | "key1": {"seconds"}, |
| 1629 | }, |
| 1630 | }, |
| 1631 | }, |
| 1632 | removeKey: "key1", |
| 1633 | wantValues: []map[string][]int64{ |
| 1634 | {}, |
| 1635 | {"key2": {1}}, |
| 1636 | {}, |
| 1637 | }, |
| 1638 | wantUnits: []map[string][]string{ |
| 1639 | {}, |
| 1640 | {"key2": {"seconds"}}, |
| 1641 | {}, |
| 1642 | }, |
| 1643 | }, |
| 1644 | { |
| 1645 | desc: "no samples have label", |
| 1646 | samples: []*Sample{ |
| 1647 | { |
| 1648 | Location: []*Location{cpuL[0]}, |
| 1649 | Value: []int64{1000}, |
| 1650 | }, |
| 1651 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…