• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

golang-migrate / migrate / 15511084249

16 May 2024 02:12PM UTC coverage: 56.314%. Remained the same
15511084249

Pull #1087

github

ccoVeille
chore: fix typos, acronym and styles
Pull Request #1087: chore: fix typos, acronym and styles

3 of 12 new or added lines in 3 files covered. (25.0%)

1 existing line in 1 file now uncovered.

4562 of 8101 relevant lines covered (56.31%)

50.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/dktesting/dktesting.go
1
package dktesting
2

3
import (
4
        "context"
5
        "fmt"
6
        "testing"
7
)
8

9
import (
10
        "github.com/dhui/dktest"
11
        "github.com/docker/docker/api/types"
12
        "github.com/docker/docker/client"
13
)
14

15
// ContainerSpec holds Docker testing setup specifications
16
type ContainerSpec struct {
17
        ImageName string
18
        Options   dktest.Options
19
}
20

×
21
// Cleanup cleanups the ContainerSpec after a test run by removing the ContainerSpec's image
×
22
func (s *ContainerSpec) Cleanup() (retErr error) {
×
23
        // copied from dktest.RunContext()
×
24
        dc, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.41"))
×
25
        if err != nil {
×
26
                return err
×
27
        }
×
28
        defer func() {
×
29
                if err := dc.Close(); err != nil && retErr == nil {
×
30
                        retErr = fmt.Errorf("error closing Docker client: %w", err)
31
                }
×
32
        }()
×
33
        cleanupTimeout := s.Options.CleanupTimeout
×
34
        if cleanupTimeout <= 0 {
×
35
                cleanupTimeout = dktest.DefaultCleanupTimeout
×
36
        }
×
37
        ctx, timeoutCancelFunc := context.WithTimeout(context.Background(), cleanupTimeout)
×
38
        defer timeoutCancelFunc()
×
39
        if _, err := dc.ImageRemove(ctx, s.ImageName, types.ImageRemoveOptions{Force: true, PruneChildren: true}); err != nil {
×
40
                return err
×
41
        }
42
        return nil
43
}
44

45
// ParallelTest runs Docker tests in parallel
×
46
func ParallelTest(t *testing.T, specs []ContainerSpec,
×
47
        testFunc func(*testing.T, dktest.ContainerInfo)) {
×
48

×
49
        for i, spec := range specs {
×
50
                spec := spec // capture range variable, see https://goo.gl/60w3p2
×
51

×
52
                // Only test against one version in short mode
×
53
                // TODO: order is random, maybe always pick first version instead?
×
54
                if i > 0 && testing.Short() {
×
55
                        t.Logf("Skipping %v in short mode", spec.ImageName)
×
56
                } else {
×
57
                        t.Run(spec.ImageName, func(t *testing.T) {
×
58
                                t.Parallel()
×
59
                                dktest.Run(t, spec.ImageName, spec.Options, testFunc)
60
                        })
61
                }
62
        }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc