(t *testing.T)
| 32 | ) |
| 33 | |
| 34 | func TestDocker(t *testing.T) { |
| 35 | t.Parallel() |
| 36 | |
| 37 | // Test the basic use case. This test doesn't test much beyond |
| 38 | // establishing that the framework is returning a default |
| 39 | // successful test. This makes it easier for individual tests |
| 40 | // to test various criteria of the command without extensive |
| 41 | // setup. |
| 42 | t.Run("OK", func(t *testing.T) { |
| 43 | t.Parallel() |
| 44 | |
| 45 | ctx, cmd := clitest.New(t, "docker", |
| 46 | "--image=ubuntu", |
| 47 | "--username=root", |
| 48 | "--agent-token=hi", |
| 49 | ) |
| 50 | |
| 51 | called := make(chan struct{}) |
| 52 | execer := clitest.Execer(ctx) |
| 53 | execer.AddCommands(&xunixfake.FakeCmd{ |
| 54 | FakeCmd: &testingexec.FakeCmd{ |
| 55 | Argv: []string{ |
| 56 | "sysbox-mgr", |
| 57 | }, |
| 58 | }, |
| 59 | WaitFn: func() error { close(called); select {} }, //nolint:revive |
| 60 | }) |
| 61 | |
| 62 | err := cmd.ExecuteContext(ctx) |
| 63 | <-called |
| 64 | require.NoError(t, err) |
| 65 | execer.AssertCommandsCalled(t) |
| 66 | }) |
| 67 | |
| 68 | t.Run("Images", func(t *testing.T) { |
| 69 | t.Parallel() |
| 70 | |
| 71 | type testcase struct { |
| 72 | name string |
| 73 | image string |
| 74 | success bool |
| 75 | } |
| 76 | |
| 77 | testcases := []testcase{ |
| 78 | { |
| 79 | name: "Repository", |
| 80 | image: "ubuntu", |
| 81 | success: true, |
| 82 | }, |
| 83 | { |
| 84 | name: "RepositoryPath", |
| 85 | image: "ubuntu/ubuntu", |
| 86 | success: true, |
| 87 | }, |
| 88 | |
| 89 | { |
| 90 | name: "RepositoryLatest", |
| 91 | image: "ubuntu:latest", |
nothing calls this directly
no test coverage detected