(t *testing.T)
| 1669 | } |
| 1670 | |
| 1671 | func TestContainerUpdate(t *testing.T) { |
| 1672 | t.Parallel() |
| 1673 | |
| 1674 | ctx, cancel := testContext(t) |
| 1675 | defer cancel() |
| 1676 | id := t.Name() |
| 1677 | |
| 1678 | client, err := newClient(t, address) |
| 1679 | if err != nil { |
| 1680 | t.Fatal(err) |
| 1681 | } |
| 1682 | defer client.Close() |
| 1683 | |
| 1684 | container, err := client.NewContainer(ctx, id, WithNewSpec()) |
| 1685 | if err != nil { |
| 1686 | t.Fatal(err) |
| 1687 | } |
| 1688 | defer container.Delete(ctx) |
| 1689 | |
| 1690 | spec, err := container.Spec(ctx) |
| 1691 | if err != nil { |
| 1692 | t.Fatal(err) |
| 1693 | } |
| 1694 | |
| 1695 | const hostname = "updated-hostname" |
| 1696 | spec.Hostname = hostname |
| 1697 | |
| 1698 | if err := container.Update(ctx, func(ctx context.Context, client *Client, c *containers.Container) error { |
| 1699 | a, err := typeurl.MarshalAny(spec) |
| 1700 | if err != nil { |
| 1701 | return err |
| 1702 | } |
| 1703 | c.Spec = a |
| 1704 | return nil |
| 1705 | }); err != nil { |
| 1706 | t.Fatal(err) |
| 1707 | } |
| 1708 | if spec, err = container.Spec(ctx); err != nil { |
| 1709 | t.Fatal(err) |
| 1710 | } |
| 1711 | if spec.Hostname != hostname { |
| 1712 | t.Errorf("hostname %q != %q", spec.Hostname, hostname) |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | func TestContainerInfo(t *testing.T) { |
| 1717 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…