File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,29 @@ Most test targets require that you build these precursor targets first:
185
185
186
186
## Running individual or multiple named tests
187
187
188
+ ### Unit tests
189
+
190
+ We use golang standard [ testing] ( https://golang.org/pkg/testing/ )
191
+ package or [ gocheck] ( https://labix.org/gocheck ) for our unit tests.
192
+
193
+ You can use the ` TESTDIRS ` environment variable to run unit tests for
194
+ a single package.
195
+
196
+ $ TESTDIRS='opts' make test-unit
197
+
198
+ You can also use the ` TESTFLAGS ` environment variable to run a single test. The
199
+ flag's value is passed as arguments to the ` go test ` command. For example, from
200
+ your local host you can run the ` TestBuild ` test with this command:
201
+
202
+ $ TESTFLAGS='-test.run ^TestValidateIPAddress$' make test-unit
203
+
204
+ On unit tests, it's better to use ` TESTFLAGS ` in combination with
205
+ ` TESTDIRS ` to make it quicker to run a specific test.
206
+
207
+ $ TESTDIRS='opts' TESTFLAGS='-test.run ^TestValidateIPAddress$' make test-unit
208
+
209
+ ### Integration tests
210
+
188
211
We use [ gocheck] ( https://labix.org/gocheck ) for our integration-cli tests.
189
212
You can use the ` TESTFLAGS ` environment variable to run a single test. The
190
213
flag's value is passed as arguments to the ` go test ` command. For example, from
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ go_run_test_dir() {
56
56
TESTS_FAILED=()
57
57
while read dir; do
58
58
echo
59
- echo ' + go test' $TESTFLAGS " ${DOCKER_PKG}${dir# .} "
59
+ echo ' + go test' $TESTFLAGS " ${DOCKER_PKG} / ${dir# ./ } "
60
60
precompiled=" $ABS_DEST /precompiled/$dir .test$( binary_extension) "
61
61
if ! ( cd " $dir " && test_env " $precompiled " $TESTFLAGS ); then
62
62
TESTS_FAILED+=(" $dir " )
You can’t perform that action at this time.
0 commit comments