mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Missed defer prepareTestEnv (#9285)
* onGiteaRun should defer the cleanup from prepareTestEnv * Some more missed defers
This commit is contained in:
		@@ -25,7 +25,7 @@ func BenchmarkRepo(b *testing.B) {
 | 
				
			|||||||
		{url: "https://github.com/golang/go.git", name: "go", skipShort: true},
 | 
							{url: "https://github.com/golang/go.git", name: "go", skipShort: true},
 | 
				
			||||||
		{url: "https://github.com/torvalds/linux.git", name: "linux", skipShort: true},
 | 
							{url: "https://github.com/torvalds/linux.git", name: "linux", skipShort: true},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	prepareTestEnv(b)
 | 
						defer prepareTestEnv(b)()
 | 
				
			||||||
	session := loginUser(b, "user2")
 | 
						session := loginUser(b, "user2")
 | 
				
			||||||
	b.ResetTimer()
 | 
						b.ResetTimer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -75,7 +75,7 @@ func StringWithCharset(length int, charset string) string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func BenchmarkRepoBranchCommit(b *testing.B) {
 | 
					func BenchmarkRepoBranchCommit(b *testing.B) {
 | 
				
			||||||
	samples := []int64{1, 3, 15, 16}
 | 
						samples := []int64{1, 3, 15, 16}
 | 
				
			||||||
	prepareTestEnv(b)
 | 
						defer prepareTestEnv(b)()
 | 
				
			||||||
	b.ResetTimer()
 | 
						b.ResetTimer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, repoID := range samples {
 | 
						for _, repoID := range samples {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,7 +78,7 @@ func allowLFSFilters() []string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bool) {
 | 
					func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bool) {
 | 
				
			||||||
	if len(prepare) == 0 || prepare[0] {
 | 
						if len(prepare) == 0 || prepare[0] {
 | 
				
			||||||
		prepareTestEnv(t, 1)
 | 
							defer prepareTestEnv(t, 1)()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	s := http.Server{
 | 
						s := http.Server{
 | 
				
			||||||
		Handler: mac,
 | 
							Handler: mac,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestGPGGit(t *testing.T) {
 | 
					func TestGPGGit(t *testing.T) {
 | 
				
			||||||
	prepareTestEnv(t)
 | 
						defer prepareTestEnv(t)()
 | 
				
			||||||
	username := "user2"
 | 
						username := "user2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// OK Set a new GPG home
 | 
						// OK Set a new GPG home
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user