github.com/covergates/covergates@v0.2.2-0.20201009050117-42ef8a19fb95/modules/scm/content_gittea_test.go (about) 1 // +build gitea 2 3 package scm 4 5 import ( 6 "context" 7 "os" 8 "testing" 9 "time" 10 11 "github.com/covergates/covergates/core" 12 "github.com/covergates/covergates/modules/git" 13 ) 14 15 func TestContentGiteaListAllFilesPerformance(t *testing.T) { 16 ctx, cancel := context.WithCancel(context.Background()) 17 defer cancel() 18 user := &core.User{ 19 GiteaToken: os.Getenv("GITEA_SECRET"), 20 } 21 service := &contentService{ 22 client: getGiteaClient(), 23 scm: core.Gitea, 24 git: &git.Service{}, 25 } 26 go func() { 27 defer cancel() 28 files, err := service.ListAllFiles( 29 ctx, 30 user, 31 "gitea/repo1", "master", 32 ) 33 if err != nil { 34 t.Error() 35 t.Log(err) 36 } 37 if len(files) <= 0 { 38 t.Fail() 39 } 40 }() 41 select { 42 case <-ctx.Done(): 43 case <-time.After(300 * time.Second): 44 t.Fail() 45 t.Log("timeout") 46 } 47 }