()
| 695 | } |
| 696 | |
| 697 | func ExampleDockerProvider_CreateContainer() { |
| 698 | ctx := context.Background() |
| 699 | nginxC, err := Run( |
| 700 | ctx, nginxAlpineImage, |
| 701 | WithExposedPorts("80/tcp"), |
| 702 | WithWaitStrategy(wait.ForHTTP("/").WithStartupTimeout(10*time.Second)), |
| 703 | ) |
| 704 | defer func() { |
| 705 | if err := TerminateContainer(nginxC); err != nil { |
| 706 | log.Printf("failed to terminate container: %s", err) |
| 707 | } |
| 708 | }() |
| 709 | if err != nil { |
| 710 | log.Printf("failed to create container: %s", err) |
| 711 | return |
| 712 | } |
| 713 | |
| 714 | state, err := nginxC.State(ctx) |
| 715 | if err != nil { |
| 716 | log.Printf("failed to get container state: %s", err) |
| 717 | return |
| 718 | } |
| 719 | |
| 720 | fmt.Println(state.Running) |
| 721 | |
| 722 | // Output: |
| 723 | // true |
| 724 | } |
| 725 | |
| 726 | func ExampleContainer_Host() { |
| 727 | ctx := context.Background() |
nothing calls this directly
no test coverage detected
searching dependent graphs…