File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,12 +6,9 @@ permissions:
66jobs :
77 test :
88 runs-on : ubuntu-latest
9-
109 steps :
1110 - uses : actions/checkout@v4
1211 - uses : actions/setup-go@v5
1312 with :
1413 go-version : ' 1'
15-
16- - run : |
17- if [ $(go mod tidy && git diff | wc -l) -gt 0 ]; then git diff && exit 1; fi
14+ - run : if [ $(go mod tidy && git diff | wc -l) -gt 0 ]; then git diff && exit 1; fi
Original file line number Diff line number Diff line change 77 test :
88 runs-on : ubuntu-latest
99 strategy :
10+ fail-fast : false
1011 matrix :
1112 go-version :
12- - ' 1 '
13+ - " 1 "
1314
1415 steps :
1516 - name : Setup Go ${{ matrix.go-version }}
2122
2223 - name : Run reauth retests
2324 run : |
24- go test -v -race -count=5 ./testing
25+ ./script/unittest
Original file line number Diff line number Diff line change 11on : [push, pull_request]
2- name : Unit tests
2+ name : Unit Testing
33permissions :
44 contents : read
55
@@ -13,20 +13,32 @@ jobs:
1313 fail-fast : false
1414 matrix :
1515 go-version :
16- - ' 1.21'
17- - ' 1'
16+ - " 1.21"
17+ - " 1"
18+
19+ env :
20+ GO111MODULE : " on"
1821
1922 steps :
20- - uses : actions/checkout@v4
2123 - name : Setup Go ${{ matrix.go-version }}
2224 uses : actions/setup-go@v5
2325 with :
2426 go-version : ${{ matrix.go-version }}
2527
28+ - uses : actions/checkout@v4
2629
2730 - name : Setup environment
2831 run : |
32+ # Changing into a different directory to avoid polluting go.sum with "go get"
33+ cd "$(mktemp -d)"
34+ go mod init unit_tests
35+
2936 go install github.com/wadey/gocovmerge@master
37+ go install golang.org/x/tools/cmd/goimports@latest
38+
39+ - name : Run go vet
40+ run : |
41+ go vet ./...
3042
3143 - name : Run unit tests
3244 run : |
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ goimports=" goimports"
4+
5+ find_files () {
6+ find . -not \( \
7+ \( \
8+ -wholename ' ./output' \
9+ -o -wholename ' ./_output' \
10+ -o -wholename ' ./_gopath' \
11+ -o -wholename ' ./release' \
12+ -o -wholename ' ./target' \
13+ -o -wholename ' */third_party/*' \
14+ -o -wholename ' */vendor/*' \
15+ \) -prune \
16+ \) -name ' *.go'
17+ }
18+
19+ ignore_files=(
20+ " ./openstack/compute/v2/extensions/quotasets/testing/fixtures.go"
21+ " ./openstack/networking/v2/extensions/vpnaas/ikepolicies/testing/requests_test.go"
22+ )
23+
24+ bad_files=$( find_files | xargs ${goimports} -l)
25+
26+ final_files=()
27+ for bad_file in $bad_files ; do
28+ found=
29+ for ignore_file in " ${ignore_files[@]} " ; do
30+ [[ " ${bad_file} " == " ${ignore_file} " ]] && { found=1; break ; }
31+ done
32+ [[ -n $found ]] || final_files+=(" $bad_file " )
33+ done
34+
35+ if [[ " ${# final_files[@]} " -gt 0 ]]; then
36+ diff=$( echo " ${final_files[@]} " | xargs ${goimports} -d -e 2>&1 )
37+ if [[ -n " ${diff} " ]]; then
38+ echo " ${diff} "
39+ exit 1
40+ fi
41+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Run the unit tests.
4+
5+ # Do extra rounds of testing to help identify reauth concurrency issues.
6+ # All other packages are tested in the `coverage` tests.
7+ go test -v -race -count=5 ./testing
You can’t perform that action at this time.
0 commit comments