(t *testing.T)
| 1613 | } |
| 1614 | |
| 1615 | func TestUpdateUlimits(t *testing.T) { |
| 1616 | ctx := context.Background() |
| 1617 | |
| 1618 | tests := []struct { |
| 1619 | name string |
| 1620 | spec []*container.Ulimit |
| 1621 | rm []string |
| 1622 | add []string |
| 1623 | expected []*container.Ulimit |
| 1624 | }{ |
| 1625 | { |
| 1626 | name: "from scratch", |
| 1627 | add: []string{"nofile=512:1024", "core=1024:1024"}, |
| 1628 | expected: []*container.Ulimit{ |
| 1629 | {Name: "core", Hard: 1024, Soft: 1024}, |
| 1630 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1631 | }, |
| 1632 | }, |
| 1633 | { |
| 1634 | name: "append new", |
| 1635 | spec: []*container.Ulimit{ |
| 1636 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1637 | }, |
| 1638 | add: []string{"core=1024:1024"}, |
| 1639 | expected: []*container.Ulimit{ |
| 1640 | {Name: "core", Hard: 1024, Soft: 1024}, |
| 1641 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1642 | }, |
| 1643 | }, |
| 1644 | { |
| 1645 | name: "remove and append new should append", |
| 1646 | spec: []*container.Ulimit{ |
| 1647 | {Name: "core", Hard: 1024, Soft: 1024}, |
| 1648 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1649 | }, |
| 1650 | rm: []string{"nofile=512:1024"}, |
| 1651 | add: []string{"nofile=512:1024"}, |
| 1652 | expected: []*container.Ulimit{ |
| 1653 | {Name: "core", Hard: 1024, Soft: 1024}, |
| 1654 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1655 | }, |
| 1656 | }, |
| 1657 | { |
| 1658 | name: "update existing", |
| 1659 | spec: []*container.Ulimit{ |
| 1660 | {Name: "nofile", Hard: 2048, Soft: 1024}, |
| 1661 | }, |
| 1662 | add: []string{"nofile=512:1024"}, |
| 1663 | expected: []*container.Ulimit{ |
| 1664 | {Name: "nofile", Hard: 1024, Soft: 512}, |
| 1665 | }, |
| 1666 | }, |
| 1667 | { |
| 1668 | name: "update existing twice", |
| 1669 | spec: []*container.Ulimit{ |
| 1670 | {Name: "nofile", Hard: 2048, Soft: 1024}, |
| 1671 | }, |
| 1672 | add: []string{"nofile=256:512", "nofile=512:1024"}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…