Skip to content

Commit 1cf64eb

Browse files
committed
debug
1 parent 3da3827 commit 1cf64eb

3 files changed

Lines changed: 69 additions & 88 deletions

File tree

.github/workflows/pull-db-tests.yml

Lines changed: 52 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -65,68 +65,61 @@ jobs:
6565
TEST_LDAP: 1
6666
USE_REPO_TEST_DIR: 1
6767

68-
test-sqlite:
68+
test-mssql:
6969
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
7070
needs: files-changed
7171
runs-on: ubuntu-latest
7272
permissions:
7373
contents: read
74+
services:
75+
mssql:
76+
image: mcr.microsoft.com/mssql/server:2019-latest
77+
env:
78+
ACCEPT_EULA: Y
79+
MSSQL_PID: Standard
80+
SA_PASSWORD: MwantsaSecurePassword1
81+
ports:
82+
- "1433:1433"
83+
devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
84+
image: mcr.microsoft.com/azure-storage/azurite:latest
85+
ports:
86+
- 10000:10000
7487
steps:
7588
- uses: actions/checkout@v6
7689
- uses: actions/setup-go@v6
7790
with:
7891
go-version-file: go.mod
7992
check-latest: true
93+
- name: Add hosts to /etc/hosts
94+
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
8095
- run: make deps-backend
81-
- run: GOEXPERIMENT='' make backend
96+
- run: make backend
8297
env:
83-
TAGS: bindata gogit sqlite sqlite_unlock_notify
84-
- name: run migration tests
85-
run: make test-sqlite-migration
98+
TAGS: bindata
99+
- run: make test-mssql-migration
86100
- name: run tests
87-
run: GOEXPERIMENT='' make test-sqlite
101+
run: make test-mssql
88102
timeout-minutes: 50
89103
env:
90-
TAGS: bindata gogit sqlite sqlite_unlock_notify
91-
RACE_ENABLED: true
92-
TEST_TAGS: gogit sqlite sqlite_unlock_notify
104+
TAGS: bindata
93105
USE_REPO_TEST_DIR: 1
94106

95-
test-unit:
107+
108+
test-mssql1:
96109
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
97110
needs: files-changed
98111
runs-on: ubuntu-latest
99112
permissions:
100113
contents: read
101114
services:
102-
elasticsearch:
103-
image: elasticsearch:7.5.0
104-
env:
105-
discovery.type: single-node
106-
ports:
107-
- "9200:9200"
108-
meilisearch:
109-
image: getmeili/meilisearch:v1
110-
env:
111-
MEILI_ENV: development # disable auth
112-
ports:
113-
- "7700:7700"
114-
redis:
115-
image: redis
116-
options: >- # wait until redis has started
117-
--health-cmd "redis-cli ping"
118-
--health-interval 5s
119-
--health-timeout 3s
120-
--health-retries 10
121-
ports:
122-
- 6379:6379
123-
minio:
124-
image: bitnamilegacy/minio:2021.3.17
115+
mssql:
116+
image: mcr.microsoft.com/mssql/server:2019-latest
125117
env:
126-
MINIO_ACCESS_KEY: 123456
127-
MINIO_SECRET_KEY: 12345678
118+
ACCEPT_EULA: Y
119+
MSSQL_PID: Standard
120+
SA_PASSWORD: MwantsaSecurePassword1
128121
ports:
129-
- "9000:9000"
122+
- "1433:1433"
130123
devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
131124
image: mcr.microsoft.com/azure-storage/azurite:latest
132125
ports:
@@ -138,78 +131,61 @@ jobs:
138131
go-version-file: go.mod
139132
check-latest: true
140133
- name: Add hosts to /etc/hosts
141-
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 minio devstoreaccount1.azurite.local mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
134+
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
142135
- run: make deps-backend
143136
- run: make backend
144137
env:
145138
TAGS: bindata
146-
- name: unit-tests
147-
run: make unit-test-coverage test-check
139+
- run: make test-mssql-migration
140+
- name: run tests
141+
run: make test-mssql
142+
timeout-minutes: 50
148143
env:
149144
TAGS: bindata
150-
RACE_ENABLED: true
151-
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
152-
- name: unit-tests-gogit
153-
run: GOEXPERIMENT='' make unit-test-coverage test-check
154-
env:
155-
TAGS: bindata gogit
156-
RACE_ENABLED: true
157-
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
145+
USE_REPO_TEST_DIR: 1
158146

159-
test-mysql:
147+
148+
test-mssql2:
160149
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
161150
needs: files-changed
162151
runs-on: ubuntu-latest
163152
permissions:
164153
contents: read
165154
services:
166-
mysql:
167-
# the bitnami mysql image has more options than the official one, it's easier to customize
168-
image: bitnamilegacy/mysql:8.0
169-
env:
170-
ALLOW_EMPTY_PASSWORD: true
171-
MYSQL_DATABASE: testgitea
172-
ports:
173-
- "3306:3306"
174-
options: >-
175-
--mount type=tmpfs,destination=/bitnami/mysql/data
176-
elasticsearch:
177-
image: elasticsearch:7.5.0
155+
mssql:
156+
image: mcr.microsoft.com/mssql/server:2019-latest
178157
env:
179-
discovery.type: single-node
158+
ACCEPT_EULA: Y
159+
MSSQL_PID: Standard
160+
SA_PASSWORD: MwantsaSecurePassword1
180161
ports:
181-
- "9200:9200"
182-
smtpimap:
183-
image: tabascoterrier/docker-imap-devel:latest
162+
- "1433:1433"
163+
devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
164+
image: mcr.microsoft.com/azure-storage/azurite:latest
184165
ports:
185-
- "25:25"
186-
- "143:143"
187-
- "587:587"
188-
- "993:993"
166+
- 10000:10000
189167
steps:
190168
- uses: actions/checkout@v6
191169
- uses: actions/setup-go@v6
192170
with:
193171
go-version-file: go.mod
194172
check-latest: true
195173
- name: Add hosts to /etc/hosts
196-
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
174+
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
197175
- run: make deps-backend
198176
- run: make backend
199177
env:
200178
TAGS: bindata
201-
- name: run migration tests
202-
run: make test-mysql-migration
179+
- run: make test-mssql-migration
203180
- name: run tests
204-
# run: make integration-test-coverage (at the moment, no coverage is really handled)
205-
run: make test-mysql
181+
run: make test-mssql
182+
timeout-minutes: 50
206183
env:
207184
TAGS: bindata
208-
RACE_ENABLED: true
209185
USE_REPO_TEST_DIR: 1
210-
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
211186

212-
test-mssql:
187+
188+
test-mssql3:
213189
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
214190
needs: files-changed
215191
runs-on: ubuntu-latest

modules/git/repo_base_nogogit.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ func (repo *Repository) Close() error {
100100
if repo == nil {
101101
return nil
102102
}
103+
repo.mu.Lock()
104+
defer repo.mu.Unlock()
103105
if repo.catFileBatchCloser != nil {
104106
repo.catFileBatchCloser.Close()
105107
repo.catFileBatchCloser = nil

modules/testlogger/testlogger.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,27 @@ func PrintCurrentTest(t testing.TB, skip ...int) func() {
108108
actualSkip := util.OptionalArg(skip) + 1
109109
_, filename, line, _ := runtime.Caller(actualSkip)
110110

111+
getRuntimeStackAll := func() string {
112+
stack := make([]byte, 1024*1024)
113+
n := runtime.Stack(stack, true)
114+
return util.UnsafeBytesToString(stack[:n])
115+
}
116+
117+
deferHasRun := false
118+
t.Cleanup(func() {
119+
Printf("--- %s (%s:%d) Cleanup\n", log.NewColoredValue(t.Name()), strings.TrimPrefix(filename, prefix), line)
120+
if !deferHasRun {
121+
Printf("!!! defer function hasn't been run but Cleanup is called\n%s", getRuntimeStackAll())
122+
}
123+
})
111124
Printf("=== %s (%s:%d)\n", log.NewColoredValue(t.Name()), strings.TrimPrefix(filename, prefix), line)
112125

113126
WriterCloser.pushT(t)
114127
timeoutChecker := time.AfterFunc(TestTimeout, func() {
115-
l := 128 * 1024
116-
var stack []byte
117-
for {
118-
stack = make([]byte, l)
119-
n := runtime.Stack(stack, true)
120-
if n <= l {
121-
stack = stack[:n]
122-
break
123-
}
124-
l = n
125-
}
126-
Printf("!!! %s ... timeout: %v ... stacktrace:\n%s\n\n", log.NewColoredValue(t.Name(), log.Bold, log.FgRed), TestTimeout, string(stack))
128+
Printf("!!! %s ... timeout: %v ... stacktrace:\n%s\n\n", log.NewColoredValue(t.Name(), log.Bold, log.FgRed), TestTimeout, getRuntimeStackAll())
127129
})
128130
return func() {
131+
deferHasRun = true
129132
flushStart := time.Now()
130133
slowFlushChecker := time.AfterFunc(TestSlowFlush, func() {
131134
Printf("+++ %s ... still flushing after %v ...\n", log.NewColoredValue(t.Name(), log.Bold, log.FgRed), TestSlowFlush)

0 commit comments

Comments
 (0)