(t *testing.T)
| 2590 | } |
| 2591 | |
| 2592 | func TestTaskSpec(t *testing.T) { |
| 2593 | t.Parallel() |
| 2594 | |
| 2595 | client, err := newClient(t, address) |
| 2596 | if err != nil { |
| 2597 | t.Fatal(err) |
| 2598 | } |
| 2599 | defer client.Close() |
| 2600 | |
| 2601 | var ( |
| 2602 | image Image |
| 2603 | ctx, cancel = testContext(t) |
| 2604 | id = t.Name() |
| 2605 | ) |
| 2606 | defer cancel() |
| 2607 | |
| 2608 | image, err = client.GetImage(ctx, testImage) |
| 2609 | if err != nil { |
| 2610 | t.Fatal(err) |
| 2611 | } |
| 2612 | |
| 2613 | container, err := client.NewContainer(ctx, id, WithNewSnapshot(id, image), WithNewSpec(oci.WithImageConfig(image), longCommand)) |
| 2614 | if err != nil { |
| 2615 | t.Fatal(err) |
| 2616 | } |
| 2617 | defer container.Delete(ctx, WithSnapshotCleanup) |
| 2618 | |
| 2619 | task, err := container.NewTask(ctx, empty()) |
| 2620 | if err != nil { |
| 2621 | t.Fatal(err) |
| 2622 | } |
| 2623 | defer task.Delete(ctx) |
| 2624 | |
| 2625 | statusC, err := task.Wait(ctx) |
| 2626 | if err != nil { |
| 2627 | t.Fatal(err) |
| 2628 | } |
| 2629 | |
| 2630 | spec, err := task.Spec(ctx) |
| 2631 | if err != nil { |
| 2632 | t.Fatal(err) |
| 2633 | } |
| 2634 | if spec == nil { |
| 2635 | t.Fatal("spec from task is nil") |
| 2636 | } |
| 2637 | direct, err := newDirectIO(ctx, false) |
| 2638 | if err != nil { |
| 2639 | t.Fatal(err) |
| 2640 | } |
| 2641 | defer direct.Delete() |
| 2642 | |
| 2643 | lt, err := container.Task(ctx, direct.IOAttach) |
| 2644 | if err != nil { |
| 2645 | t.Fatal(err) |
| 2646 | } |
| 2647 | |
| 2648 | spec, err = lt.Spec(ctx) |
| 2649 | if err != nil { |
nothing calls this directly
no test coverage detected
searching dependent graphs…