(t *testing.T)
| 1120 | } |
| 1121 | |
| 1122 | func TestWaitStoppedProcess(t *testing.T) { |
| 1123 | t.Parallel() |
| 1124 | |
| 1125 | client, err := newClient(t, address) |
| 1126 | if err != nil { |
| 1127 | t.Fatal(err) |
| 1128 | } |
| 1129 | defer client.Close() |
| 1130 | |
| 1131 | var ( |
| 1132 | image Image |
| 1133 | ctx, cancel = testContext(t) |
| 1134 | id = t.Name() |
| 1135 | ) |
| 1136 | defer cancel() |
| 1137 | |
| 1138 | image, err = client.GetImage(ctx, testImage) |
| 1139 | if err != nil { |
| 1140 | t.Fatal(err) |
| 1141 | } |
| 1142 | |
| 1143 | container, err := client.NewContainer(ctx, id, WithNewSnapshot(id, image), WithNewSpec(oci.WithImageConfig(image), longCommand)) |
| 1144 | if err != nil { |
| 1145 | t.Fatal(err) |
| 1146 | } |
| 1147 | defer container.Delete(ctx, WithSnapshotCleanup) |
| 1148 | |
| 1149 | task, err := container.NewTask(ctx, empty()) |
| 1150 | if err != nil { |
| 1151 | t.Fatal(err) |
| 1152 | } |
| 1153 | defer task.Delete(ctx) |
| 1154 | |
| 1155 | finishedC, err := task.Wait(ctx) |
| 1156 | if err != nil { |
| 1157 | t.Error(err) |
| 1158 | } |
| 1159 | |
| 1160 | if err := task.Start(ctx); err != nil { |
| 1161 | t.Fatal(err) |
| 1162 | } |
| 1163 | spec, err := container.Spec(ctx) |
| 1164 | if err != nil { |
| 1165 | t.Fatal(err) |
| 1166 | } |
| 1167 | |
| 1168 | // start an exec process without running the original container process info |
| 1169 | processSpec := spec.Process |
| 1170 | withExecExitStatus(processSpec, 6) |
| 1171 | execID := t.Name() + "_exec" |
| 1172 | process, err := task.Exec(ctx, execID, processSpec, empty()) |
| 1173 | if err != nil { |
| 1174 | t.Fatal(err) |
| 1175 | } |
| 1176 | defer process.Delete(ctx) |
| 1177 | |
| 1178 | statusC, err := process.Wait(ctx) |
| 1179 | if err != nil { |
nothing calls this directly
no test coverage detected
searching dependent graphs…