mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	Refactor older tests to use testify (#33140)
Refactor checks to use assert/require Use require.Eventually for waiting in elastic and meilisearch tests Use require to exit early instead of assert
This commit is contained in:
		@@ -14,6 +14,7 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
	"github.com/stretchr/testify/require"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func waitRedisReady(conn string, dur time.Duration) (ready bool) {
 | 
			
		||||
@@ -61,9 +62,7 @@ func TestBaseRedis(t *testing.T) {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		assert.NoError(t, redisServer.Start())
 | 
			
		||||
		if !assert.True(t, waitRedisReady("redis://127.0.0.1:6379/0", 5*time.Second), "start redis-server") {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		require.True(t, waitRedisReady("redis://127.0.0.1:6379/0", 5*time.Second), "start redis-server")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	testQueueBasic(t, newBaseRedisSimple, toBaseConfig("baseRedis", setting.QueueSettings{Length: 10}), false)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user