(t *testing.T)
| 761 | } |
| 762 | |
| 763 | func TestCreateWithCustomMACs(t *testing.T) { |
| 764 | skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 765 | skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.44"), "requires API v1.44") |
| 766 | |
| 767 | ctx := setupTest(t) |
| 768 | apiClient := testEnv.APIClient() |
| 769 | |
| 770 | net.CreateNoError(ctx, t, apiClient, "testnet") |
| 771 | |
| 772 | attachCtx, cancel := context.WithTimeout(ctx, 5*time.Second) |
| 773 | defer cancel() |
| 774 | res := testContainer.RunAttach(attachCtx, t, apiClient, |
| 775 | testContainer.WithCmd("ip", "-o", "link", "show"), |
| 776 | testContainer.WithNetworkMode("bridge"), |
| 777 | testContainer.WithMacAddress("bridge", "02:32:1c:23:00:04")) |
| 778 | |
| 779 | assert.Equal(t, res.ExitCode, 0) |
| 780 | assert.Equal(t, res.Stderr.String(), "") |
| 781 | |
| 782 | scanner := bufio.NewScanner(res.Stdout) |
| 783 | for scanner.Scan() { |
| 784 | fields := strings.Fields(scanner.Text()) |
| 785 | // The expected output is: |
| 786 | // 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000\ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 |
| 787 | // 134: eth0@if135: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1400 qdisc noqueue \ link/ether 02:42:ac:11:00:04 brd ff:ff:ff:ff:ff:ff |
| 788 | if len(fields) < 11 { |
| 789 | continue |
| 790 | } |
| 791 | |
| 792 | ifaceName := fields[1] |
| 793 | if ifaceName[:3] != "eth" { |
| 794 | continue |
| 795 | } |
| 796 | |
| 797 | mac := fields[len(fields)-3] |
| 798 | assert.Equal(t, mac, "02:32:1c:23:00:04") |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | // Tests that when using containerd backed storage the containerd container has the image referenced stored. |
| 803 | func TestContainerdContainerImageInfo(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…