mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-04 15:02:36 +02:00
test: Make sure tests that change global state are not executed concurrently.
This commit is contained in:
parent
a50d637107
commit
4603b2b290
|
@ -28,6 +28,9 @@ import (
|
|||
)
|
||||
|
||||
func UpdateCertificateCheckIntervalForTest(t *testing.T, interval time.Duration) {
|
||||
t.Helper()
|
||||
// Make sure test is not executed with "t.Parallel()"
|
||||
t.Setenv("PARALLEL_CHECK", "1")
|
||||
old := deduplicateWatchEvents.Load()
|
||||
t.Cleanup(func() {
|
||||
deduplicateWatchEvents.Store(old)
|
||||
|
|
|
@ -98,7 +98,6 @@ func NewGrpcServerForTest(t *testing.T) (server *GrpcServer, addr string) {
|
|||
}
|
||||
|
||||
func Test_GrpcServer_ReloadCerts(t *testing.T) {
|
||||
t.Parallel()
|
||||
CatchLogForTest(t)
|
||||
key, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||
if err != nil {
|
||||
|
@ -180,7 +179,6 @@ func Test_GrpcServer_ReloadCerts(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_GrpcServer_ReloadCA(t *testing.T) {
|
||||
t.Parallel()
|
||||
CatchLogForTest(t)
|
||||
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||
if err != nil {
|
||||
|
|
|
@ -36,6 +36,8 @@ var listenSignalOnce sync.Once
|
|||
|
||||
func ensureNoGoroutinesLeak(t *testing.T, f func(t *testing.T)) {
|
||||
t.Helper()
|
||||
// Make sure test is not executed with "t.Parallel()"
|
||||
t.Setenv("PARALLEL_CHECK", "1")
|
||||
|
||||
// The signal package will start a goroutine the first time "signal.Notify"
|
||||
// is called. Do so outside the function under test so the signal goroutine
|
||||
|
|
Loading…
Reference in a new issue