|
25 | 25 | exit 1 |
26 | 26 | fi |
27 | 27 |
|
28 | | -# If a service is specified, only test that service |
29 | | -if [ ! -z "${SERVICE}" ]; then |
30 | | - echo ">> Testing services/${SERVICE}" |
31 | | - cd ${SERVICES_PATH}/${SERVICE} |
| 28 | +test_service() { |
| 29 | + service=$1 |
| 30 | + |
| 31 | + echo ">> Testing services/${service}" |
32 | 32 | if [ "${SKIP_NON_GENERATED_FILES}" = true ]; then |
33 | | - go test ./ ${GOTEST_ARGS} # All manually maintained files are in subfolders |
| 33 | + go test ${SERVICES_PATH}/${service}/... ${GOTEST_ARGS} # All manually maintained files are in subfolders |
34 | 34 | else |
35 | | - go test ./... ${GOTEST_ARGS} |
| 35 | + go test ${SERVICES_PATH}/${service}/... ${GOTEST_ARGS} |
36 | 36 | fi |
37 | | - exit 0 |
38 | | -# Otherwise, test all modules |
39 | | -else |
| 37 | +} |
40 | 38 |
|
| 39 | +# If a service is specified, only test that service |
| 40 | +if [ ! -z "${SERVICE}" ]; then |
| 41 | + test_service ${SERVICE} |
| 42 | +# Otherwise, test all services and core |
| 43 | +else |
41 | 44 | if [ "${SKIP_NON_GENERATED_FILES}" = false ]; then |
42 | 45 | echo ">> Testing core" |
43 | | - cd ${CORE_PATH} |
44 | | - go test ./... ${GOTEST_ARGS} |
| 46 | + go test ${CORE_PATH}/... ${GOTEST_ARGS} |
45 | 47 | fi |
46 | 48 |
|
47 | 49 | for service_dir in ${SERVICES_PATH}/*; do |
|
54 | 56 | continue |
55 | 57 | fi |
56 | 58 |
|
57 | | - echo ">> Testing services/${service}" |
58 | | - cd ${service_dir} |
59 | | - if [ "${SKIP_NON_GENERATED_FILES}" = true ]; then |
60 | | - go test ./ ${GOTEST_ARGS} # All manually maintained files are in subfolders |
61 | | - else |
62 | | - go test ./... ${GOTEST_ARGS} |
63 | | - fi |
| 59 | + test_service ${service} |
64 | 60 | done |
65 | 61 | fi |
0 commit comments