(t *testing.T, ctx context.Context, prefix string)
| 958 | } |
| 959 | |
| 960 | func countContainers(t *testing.T, ctx context.Context, prefix string) int { |
| 961 | t.Helper() |
| 962 | c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) |
| 963 | require.NoError(t, err) |
| 964 | defer c.Close() |
| 965 | |
| 966 | containers, err := c.ContainerList(ctx, container.ListOptions{All: true}) |
| 967 | require.NoError(t, err) |
| 968 | |
| 969 | count := 0 |
| 970 | for _, ctr := range containers { |
| 971 | if len(ctr.Names) == 0 { |
| 972 | continue |
| 973 | } |
| 974 | name := strings.TrimPrefix(ctr.Names[0], "/") |
| 975 | if strings.HasPrefix(name, prefix) { |
| 976 | count++ |
| 977 | } |
| 978 | } |
| 979 | return count |
| 980 | } |
| 981 | |
| 982 | func execInContainer(t *testing.T, ctx context.Context, containerName string, cmd []string) { |
| 983 | t.Helper() |
no test coverage detected
searching dependent graphs…