(t *testing.T)
| 942 | } |
| 943 | |
| 944 | func TestContainerNoBinaryExists(t *testing.T) { |
| 945 | t.Parallel() |
| 946 | |
| 947 | client, err := newClient(t, address) |
| 948 | if err != nil { |
| 949 | t.Fatal(err) |
| 950 | } |
| 951 | defer client.Close() |
| 952 | |
| 953 | var ( |
| 954 | image Image |
| 955 | ctx, cancel = testContext(t) |
| 956 | id = t.Name() |
| 957 | ) |
| 958 | defer cancel() |
| 959 | |
| 960 | image, err = client.GetImage(ctx, testImage) |
| 961 | if err != nil { |
| 962 | t.Fatal(err) |
| 963 | } |
| 964 | |
| 965 | container, err := client.NewContainer(ctx, id, |
| 966 | WithNewSnapshot(id, image), |
| 967 | WithNewSpec(oci.WithImageConfig(image), oci.WithProcessArgs("nothing"))) |
| 968 | if err != nil { |
| 969 | t.Fatal(err) |
| 970 | } |
| 971 | defer container.Delete(ctx, WithSnapshotCleanup) |
| 972 | |
| 973 | task, err := container.NewTask(ctx, empty()) |
| 974 | switch runtime.GOOS { |
| 975 | case "windows": |
| 976 | if err != nil { |
| 977 | t.Fatalf("failed to create task %v", err) |
| 978 | } |
| 979 | defer task.Delete(ctx, WithProcessKill) |
| 980 | if err := task.Start(ctx); err == nil { |
| 981 | t.Error("task.Start() should return an error when binary does not exist") |
| 982 | } |
| 983 | default: |
| 984 | if err == nil { |
| 985 | t.Error("NewTask should return an error when binary does not exist") |
| 986 | task.Delete(ctx) |
| 987 | } |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | func TestContainerExecNoBinaryExists(t *testing.T) { |
| 992 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…