MCPcopy Index your code
hub / github.com/docker/cli / TestUpdateUlimits

Function TestUpdateUlimits

cli/command/service/update_test.go:1615–1729  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1613}
1614
1615func 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"},

Callers

nothing calls this directly

Calls 3

updateServiceFunction · 0.85
newUpdateCommandFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…