Skip to content

Commit f85849e

Browse files
committed
Integration tests: speed up filtered runs
Golang supports `go test -run ...` to filter test execution, and this can be used to filter subtests as well. For example `go test -run Integ/Handler` will only run integration tests containing the word Handler in the test method name. Previously this was rather slow, because the integration test suite's BeforeTest() method was still executed for every skipped test. This commit updates dep github.com/skeema/tengo to add logic preventing unnecessary redundant BeforeTest() calls.
1 parent 9342d1e commit f85849e

File tree

9 files changed

+37
-26
lines changed

9 files changed

+37
-26
lines changed

applier/applier_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (s *ApplierIntegrationSuite) Teardown(backend string) error {
9494
return g.Wait()
9595
}
9696

97-
func (s *ApplierIntegrationSuite) BeforeTest(method string, backend string) error {
97+
func (s *ApplierIntegrationSuite) BeforeTest(backend string) error {
9898
var g errgroup.Group
9999
for n := range s.d {
100100
n := n

dumper/dumper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (s *IntegrationSuite) Teardown(backend string) error {
137137
return os.RemoveAll(s.scratchPath())
138138
}
139139

140-
func (s *IntegrationSuite) BeforeTest(method string, backend string) error {
140+
func (s *IntegrationSuite) BeforeTest(backend string) error {
141141
if err := s.d.NukeData(); err != nil {
142142
return err
143143
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/opencontainers/selinux v1.3.0 // indirect
1818
github.com/sirupsen/logrus v1.4.2
1919
github.com/skeema/mybase v1.0.8
20-
github.com/skeema/tengo v0.8.18
20+
github.com/skeema/tengo v0.8.19-0.20191008200715-c840b0ecb8a2
2121
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
2222
golang.org/x/lint v0.0.0-20190409202823-959b441ac422
2323
golang.org/x/sync v0.0.0-20190423024810-112230192c58

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ github.com/skeema/mybase v1.0.8 h1:eqtxi5FfphYhosEEeHBsYf/9oXfwjCZ8fMnpGJ+AdxI=
6363
github.com/skeema/mybase v1.0.8/go.mod h1:09Uz3MIoXTNCUZWBeKDeO8SUHlQNjIEocXbc1DFvEKQ=
6464
github.com/skeema/tengo v0.8.18 h1:+w86N5HxvvULTLeQlgRmzjgYYamxklytpU/jnxMfPr8=
6565
github.com/skeema/tengo v0.8.18/go.mod h1:iz608OkLZGwQUFMwivJCldvM4sxk57p5nt9UCWyJwO0=
66+
github.com/skeema/tengo v0.8.19-0.20191008200715-c840b0ecb8a2 h1:rLI7qp4nehKQivZWrEEdkZMOnh+vOp61X8zjqRA3aa0=
67+
github.com/skeema/tengo v0.8.19-0.20191008200715-c840b0ecb8a2/go.mod h1:iz608OkLZGwQUFMwivJCldvM4sxk57p5nt9UCWyJwO0=
6668
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6769
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
6870
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=

linter/linter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (s *IntegrationSuite) Teardown(backend string) error {
8585
return s.d.Stop()
8686
}
8787

88-
func (s *IntegrationSuite) BeforeTest(method string, backend string) error {
88+
func (s *IntegrationSuite) BeforeTest(backend string) error {
8989
return s.d.NukeData()
9090
}
9191

skeema_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (s *SkeemaIntegrationSuite) Teardown(backend string) error {
7777
return nil
7878
}
7979

80-
func (s *SkeemaIntegrationSuite) BeforeTest(method string, backend string) error {
80+
func (s *SkeemaIntegrationSuite) BeforeTest(backend string) error {
8181
// Clear data and re-source setup data
8282
if err := s.d.NukeData(); err != nil {
8383
return err

vendor/github.com/skeema/tengo/testing.go

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
2-
github.com/Azure/go-ansiterm
32
github.com/Azure/go-ansiterm/winterm
3+
github.com/Azure/go-ansiterm
44
# github.com/Microsoft/go-winio v0.4.7
55
github.com/Microsoft/go-winio
66
# github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5
@@ -13,31 +13,31 @@ github.com/alecthomas/participle/lexer
1313
# github.com/containerd/continuity v0.0.0-20180612233548-246e49050efd
1414
github.com/containerd/continuity/pathdriver
1515
# github.com/docker/docker v0.0.0-20180412203414-a422774e593b
16-
github.com/docker/docker/api/types
17-
github.com/docker/docker/api/types/blkiodev
18-
github.com/docker/docker/api/types/container
19-
github.com/docker/docker/api/types/filters
20-
github.com/docker/docker/api/types/mount
21-
github.com/docker/docker/api/types/network
2216
github.com/docker/docker/api/types/registry
23-
github.com/docker/docker/api/types/strslice
2417
github.com/docker/docker/api/types/swarm
25-
github.com/docker/docker/api/types/swarm/runtime
26-
github.com/docker/docker/api/types/versions
2718
github.com/docker/docker/opts
2819
github.com/docker/docker/pkg/archive
2920
github.com/docker/docker/pkg/fileutils
3021
github.com/docker/docker/pkg/homedir
22+
github.com/docker/docker/pkg/jsonmessage
23+
github.com/docker/docker/pkg/stdcopy
24+
github.com/docker/docker/api/types/container
25+
github.com/docker/docker/api/types/mount
26+
github.com/docker/docker/api/types/network
27+
github.com/docker/docker/api/types/swarm/runtime
28+
github.com/docker/docker/api/types
3129
github.com/docker/docker/pkg/idtools
3230
github.com/docker/docker/pkg/ioutils
33-
github.com/docker/docker/pkg/jsonmessage
3431
github.com/docker/docker/pkg/longpath
35-
github.com/docker/docker/pkg/mount
3632
github.com/docker/docker/pkg/pools
37-
github.com/docker/docker/pkg/stdcopy
3833
github.com/docker/docker/pkg/system
3934
github.com/docker/docker/pkg/term
35+
github.com/docker/docker/api/types/blkiodev
36+
github.com/docker/docker/api/types/strslice
37+
github.com/docker/docker/api/types/filters
38+
github.com/docker/docker/pkg/mount
4039
github.com/docker/docker/pkg/term/windows
40+
github.com/docker/docker/api/types/versions
4141
# github.com/docker/go-connections v0.3.0
4242
github.com/docker/go-connections/nat
4343
# github.com/docker/go-units v0.3.3
@@ -62,8 +62,8 @@ github.com/nozzle/throttler
6262
# github.com/opencontainers/go-digest v1.0.0-rc1
6363
github.com/opencontainers/go-digest
6464
# github.com/opencontainers/image-spec v1.0.1
65-
github.com/opencontainers/image-spec/specs-go
6665
github.com/opencontainers/image-spec/specs-go/v1
66+
github.com/opencontainers/image-spec/specs-go
6767
# github.com/opencontainers/runc v1.0.0-rc5
6868
github.com/opencontainers/runc/libcontainer/system
6969
github.com/opencontainers/runc/libcontainer/user
@@ -75,13 +75,13 @@ github.com/pmezard/go-difflib/difflib
7575
github.com/sirupsen/logrus
7676
# github.com/skeema/mybase v1.0.8
7777
github.com/skeema/mybase
78-
# github.com/skeema/tengo v0.8.18
78+
# github.com/skeema/tengo v0.8.19-0.20191008200715-c840b0ecb8a2
7979
github.com/skeema/tengo
8080
# golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
8181
golang.org/x/crypto/ssh/terminal
8282
# golang.org/x/lint v0.0.0-20190409202823-959b441ac422
83-
golang.org/x/lint
8483
golang.org/x/lint/golint
84+
golang.org/x/lint
8585
# golang.org/x/net v0.0.0-20190620200207-3b0461eec859
8686
golang.org/x/net/context
8787
# golang.org/x/sync v0.0.0-20190423024810-112230192c58

workspace/workspace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (s *WorkspaceIntegrationSuite) Teardown(backend string) error {
289289
return s.d.Stop()
290290
}
291291

292-
func (s *WorkspaceIntegrationSuite) BeforeTest(method string, backend string) error {
292+
func (s *WorkspaceIntegrationSuite) BeforeTest(backend string) error {
293293
return s.d.NukeData()
294294
}
295295

0 commit comments

Comments
 (0)