Skip to content

Commit cf21916

Browse files
author
Aaron Schlesinger
committed
fix(pkg/sshd/server_test.go): add test for withCleanerLock
1 parent afffe1c commit cf21916

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pkg/sshd/server_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ func TestManyConcurrentPushes(t *testing.T) {
198198
assert.NoErr(t, waitWithTimeout(&wg, 1*time.Second))
199199
}
200200

201+
func TestWithCleanerLock(t *testing.T) {
202+
srv := &server{cleanerRef: cleaner.NewRef()}
203+
var wg sync.WaitGroup
204+
for i := 0; i < 100; i++ {
205+
wg.Add(1)
206+
go func(i int) {
207+
err := srv.withCleanerLock(func() error {
208+
wg.Done()
209+
return nil
210+
})
211+
assert.NoErr(t, err)
212+
}(i)
213+
}
214+
assert.NoErr(t, waitWithTimeout(&wg, 1*time.Second))
215+
}
216+
201217
func TestDelete(t *testing.T) {
202218
const testingServerAddr = "127.0.0.1:2246"
203219
key, err := sshTestingHostKey()

0 commit comments

Comments
 (0)