Skip to content

Commit 8689ac2

Browse files
committed
[chore] check go tests race
Signed-off-by: Alexey Paschenko <[email protected]>
1 parent 0038647 commit 8689ac2

File tree

5 files changed

+642
-528
lines changed

5 files changed

+642
-528
lines changed

.github/ci_templates/tests.yml

+106-106
Original file line numberDiff line numberDiff line change
@@ -5,118 +5,118 @@ docker_options: '-w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xter
55
# <template: unit_run_args>
66
{!{- end -}!}
77

8-
{!{ define "dhctl_run_args" }!}
9-
# <template: dhctl_run_args>
10-
args: 'make ci'
11-
docker_options: '-w /deckhouse/dhctl -v ~/go-pkg-cache:/go/pkg'
12-
# </template: dhctl_run_args>
13-
{!{- end -}!}
8+
# {!{ define "dhctl_run_args" }!}
9+
# # <template: dhctl_run_args>
10+
# args: 'make ci'
11+
# docker_options: '-w /deckhouse/dhctl -v ~/go-pkg-cache:/go/pkg'
12+
# # </template: dhctl_run_args>
13+
# {!{- end -}!}
1414

15-
{!{ define "golangci_lint_run_args" }!}
16-
# <template: golangci_lint_run_args>
17-
args: 'sh -c "go generate tools/register.go && GOGC=50 GOFLAGS=\"-buildvcs=false\" golangci-lint run"'
18-
docker_options: '-w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg'
19-
# </template: golangci_lint_run_args>
20-
{!{- end -}!}
15+
# {!{ define "golangci_lint_run_args" }!}
16+
# # <template: golangci_lint_run_args>
17+
# args: 'sh -c "go generate tools/register.go && GOGC=50 GOFLAGS=\"-buildvcs=false\" golangci-lint run"'
18+
# docker_options: '-w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg'
19+
# # </template: golangci_lint_run_args>
20+
# {!{- end -}!}
2121

22-
{!{ define "openapi_test_cases_run_args" }!}
23-
# <template: openapi_test_cases_run_args>
24-
args: 'ginkgo -vet=off ./testing/openapi_cases/'
25-
docker_options: '-v ${{github.workspace}}:/deckhouse -w /deckhouse -v ~/go-pkg-cache:/go/pkg'
26-
# </template: openapi_test_cases_run_args>
27-
{!{- end -}!}
22+
# {!{ define "openapi_test_cases_run_args" }!}
23+
# # <template: openapi_test_cases_run_args>
24+
# args: 'ginkgo -vet=off ./testing/openapi_cases/'
25+
# docker_options: '-v ${{github.workspace}}:/deckhouse -w /deckhouse -v ~/go-pkg-cache:/go/pkg'
26+
# # </template: openapi_test_cases_run_args>
27+
# {!{- end -}!}
2828

29-
{!{ define "validators_run_args" }!}
30-
# <template: validators_run_args>
31-
args: 'go test -tags=validation -run Validation -timeout=${{env.TEST_TIMEOUT}} ./testing/...'
32-
docker_options: '-w /deckhouse -v ~/go-pkg-cache:/go/pkg'
33-
# </template: validators_run_args>
34-
{!{- end -}!}
29+
# {!{ define "validators_run_args" }!}
30+
# # <template: validators_run_args>
31+
# args: 'go test -tags=validation -run Validation -timeout=${{env.TEST_TIMEOUT}} ./testing/...'
32+
# docker_options: '-w /deckhouse -v ~/go-pkg-cache:/go/pkg'
33+
# # </template: validators_run_args>
34+
# {!{- end -}!}
3535

36-
{!{ define "tests_template" }!}
37-
# <template: tests_template>
38-
{!{- $ctx := index . 0 }!}
39-
{!{- $args_name := index . 1 }!}
40-
{!{- $build_job := index . 2 }!}
41-
{!{- $args_tmpl := printf "%s_run_args" $args_name }!}
42-
{!{- $default := dict "image" "tests" "args" "echo no args" "docker_options" "" }!}
43-
{!{- $run := coll.Merge (tmpl.Exec $args_tmpl | yaml) $default }!}
44-
runs-on: [self-hosted, regular]
45-
steps:
46-
{!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
47-
{!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
48-
{!{ tmpl.Exec "login_dev_registry_step" $ctx | strings.Indent 2 }!}
49-
{!{ tmpl.Exec "login_rw_registry_step" $ctx | strings.Indent 2 }!}
50-
- name: Run tests
51-
env:
52-
TESTS_IMAGE_NAME: ${{needs.{!{$build_job}!}.outputs.tests_image_name}}
53-
run: |
54-
if [[ -z ${TESTS_IMAGE_NAME} ]] ; then
55-
echo "TESTS_IMAGE_NAME is empty"
56-
exit 1
57-
fi
36+
# {!{ define "tests_template" }!}
37+
# # <template: tests_template>
38+
# {!{- $ctx := index . 0 }!}
39+
# {!{- $args_name := index . 1 }!}
40+
# {!{- $build_job := index . 2 }!}
41+
# {!{- $args_tmpl := printf "%s_run_args" $args_name }!}
42+
# {!{- $default := dict "image" "tests" "args" "echo no args" "docker_options" "" }!}
43+
# {!{- $run := coll.Merge (tmpl.Exec $args_tmpl | yaml) $default }!}
44+
# runs-on: [self-hosted, regular]
45+
# steps:
46+
# {!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
47+
# {!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
48+
# {!{ tmpl.Exec "login_dev_registry_step" $ctx | strings.Indent 2 }!}
49+
# {!{ tmpl.Exec "login_rw_registry_step" $ctx | strings.Indent 2 }!}
50+
# - name: Run tests
51+
# env:
52+
# TESTS_IMAGE_NAME: ${{needs.{!{$build_job}!}.outputs.tests_image_name}}
53+
# run: |
54+
# if [[ -z ${TESTS_IMAGE_NAME} ]] ; then
55+
# echo "TESTS_IMAGE_NAME is empty"
56+
# exit 1
57+
# fi
5858

59-
# Decode image name from gzip+base64.
60-
TESTS_IMAGE_NAME=$(echo ${TESTS_IMAGE_NAME} | base64 -d | gunzip)
59+
# # Decode image name from gzip+base64.
60+
# TESTS_IMAGE_NAME=$(echo ${TESTS_IMAGE_NAME} | base64 -d | gunzip)
6161

62-
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
63-
echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
64-
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
65-
docker pull ${TESTS_IMAGE_NAME}
66-
echo "⚓️ 🏎 [$(date -u)] Run tests..."
67-
docker run {!{ $run.docker_options }!} ${TESTS_IMAGE_NAME} {!{ $run.args }!}
68-
# </template: tests_template>
69-
{!{- end -}!}
62+
# # Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
63+
# echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
64+
# echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
65+
# docker pull ${TESTS_IMAGE_NAME}
66+
# echo "⚓️ 🏎 [$(date -u)] Run tests..."
67+
# docker run {!{ $run.docker_options }!} ${TESTS_IMAGE_NAME} {!{ $run.args }!}
68+
# # </template: tests_template>
69+
# {!{- end -}!}
7070

71-
{!{/* TODO change args in tests_template and merge two templates */}!}
72-
{!{ define "tests_before_build_template" }!}
73-
# <template: tests_before_build_template>
74-
{!{- $ctx := index . 0 }!}
75-
{!{- $args_name := index . 1 }!}
76-
{!{- $args_tmpl := printf "%s_run_args" $args_name }!}
77-
{!{- $default := dict "image" "tests" "args" "echo no args" "docker_options" "" }!}
78-
{!{- $run := coll.Merge (tmpl.Exec $args_tmpl | yaml) $default }!}
79-
runs-on: [self-hosted, regular]
80-
steps:
81-
{!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
82-
{!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
83-
{!{ tmpl.Exec "login_dev_registry_step" $ctx | strings.Indent 2 }!}
84-
{!{ tmpl.Exec "login_rw_registry_step" $ctx | strings.Indent 2 }!}
85-
- name: Run tests
86-
env:
87-
TESTS_IMAGE_NAME: {!{ printf "%s%s" (datasource "image_versions").REGISTRY_PATH (datasource "image_versions").BASE_GOLANG_23_BULLSEYE | quote }!}
88-
run: |
89-
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
90-
echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
91-
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
92-
docker pull ${TESTS_IMAGE_NAME}
93-
echo "⚓️ 🏎 [$(date -u)] Run tests..."
94-
docker run {!{ $run.docker_options }!} ${TESTS_IMAGE_NAME} {!{ $run.args }!}
95-
# </template: tests_before_build_template>
96-
{!{- end -}!}
71+
# {!{/* TODO change args in tests_template and merge two templates */}!}
72+
# {!{ define "tests_before_build_template" }!}
73+
# # <template: tests_before_build_template>
74+
# {!{- $ctx := index . 0 }!}
75+
# {!{- $args_name := index . 1 }!}
76+
# {!{- $args_tmpl := printf "%s_run_args" $args_name }!}
77+
# {!{- $default := dict "image" "tests" "args" "echo no args" "docker_options" "" }!}
78+
# {!{- $run := coll.Merge (tmpl.Exec $args_tmpl | yaml) $default }!}
79+
# runs-on: [self-hosted, regular]
80+
# steps:
81+
# {!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
82+
# {!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
83+
# {!{ tmpl.Exec "login_dev_registry_step" $ctx | strings.Indent 2 }!}
84+
# {!{ tmpl.Exec "login_rw_registry_step" $ctx | strings.Indent 2 }!}
85+
# - name: Run tests
86+
# env:
87+
# TESTS_IMAGE_NAME: {!{ printf "%s%s" (datasource "image_versions").REGISTRY_PATH (datasource "image_versions").BASE_GOLANG_23_BULLSEYE | quote }!}
88+
# run: |
89+
# # Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
90+
# echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
91+
# echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
92+
# docker pull ${TESTS_IMAGE_NAME}
93+
# echo "⚓️ 🏎 [$(date -u)] Run tests..."
94+
# docker run {!{ $run.docker_options }!} ${TESTS_IMAGE_NAME} {!{ $run.args }!}
95+
# # </template: tests_before_build_template>
96+
# {!{- end -}!}
9797

98-
{!{ define "tests_webhooks_template" }!}
99-
# <template: tests_webhooks_template>
100-
{!{- $ctx := index . 0 }!}
101-
runs-on: [self-hosted, regular]
102-
steps:
103-
{!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
104-
{!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
105-
- name: Run python webhook tests
106-
run: |
107-
make tests-webhooks
108-
# </template: tests_webhooks_template>
109-
{!{- end -}!}
98+
# {!{ define "tests_webhooks_template" }!}
99+
# # <template: tests_webhooks_template>
100+
# {!{- $ctx := index . 0 }!}
101+
# runs-on: [self-hosted, regular]
102+
# steps:
103+
# {!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
104+
# {!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
105+
# - name: Run python webhook tests
106+
# run: |
107+
# make tests-webhooks
108+
# # </template: tests_webhooks_template>
109+
# {!{- end -}!}
110110

111-
{!{ define "tests_dmt_lint" }!}
112-
# <template: tests_dmt_lint>
113-
{!{- $ctx := index . 0 }!}
114-
runs-on: [self-hosted, regular]
115-
steps:
116-
{!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
117-
{!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
118-
- name: DMT lint
119-
run: |
120-
make dmt-lint
121-
# </template: tests_dmt_lint>
122-
{!{- end -}!}
111+
# {!{ define "tests_dmt_lint" }!}
112+
# # <template: tests_dmt_lint>
113+
# {!{- $ctx := index . 0 }!}
114+
# runs-on: [self-hosted, regular]
115+
# steps:
116+
# {!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
117+
# {!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
118+
# - name: DMT lint
119+
# run: |
120+
# make dmt-lint
121+
# # </template: tests_dmt_lint>
122+
# {!{- end -}!}

0 commit comments

Comments
 (0)