mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
fix: misc fixes in pub/gpg/tests (#38809)
- The pub registry reported the oldest version as `latest`, because the descriptor slice is sorted ascending but the first element was used. - Verifying a GPG or SSH key flashed success and redirected after already writing an error response, so a failure was reported as a success with an empty key id. - Test packages sharing redis could tear down each other's server. `PrepareTestRedis` started its own on the well-known port, so a package running in parallel borrowed it and lost it when the owner's cleanup fired. It now listens on a socket of its own.
This commit is contained in:
@@ -7,6 +7,9 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.dev/modules/test"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -14,6 +17,7 @@ import (
|
||||
|
||||
func TestLockAndDo(t *testing.T) {
|
||||
t.Run("redis", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&redisLockExpiry, 5*time.Second)() // Close waits for the extend goroutine's next tick
|
||||
locker := newTestRedisLocker(t)
|
||||
defaultLocker.Store(new(locker))
|
||||
testLockAndDo(t)
|
||||
|
||||
Reference in New Issue
Block a user