github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/sys/it/race_signup_test.go (about) 1 /* 2 * Copyright (c) 2021-present unTill Pro, Ltd. 3 */ 4 5 package sys_it 6 7 import ( 8 "fmt" 9 "strconv" 10 "sync" 11 "testing" 12 13 "github.com/voedger/voedger/pkg/istructs" 14 it "github.com/voedger/voedger/pkg/vit" 15 ) 16 17 const ( 18 loginCnt = 20 19 ) 20 21 // note: Test_Race_SUCreateLogin is eliminated because chain Test_Race_SUCreateLogin(t) + Test_Race_SUsignUpIn(t) hangs for 30 seconds 22 // Do SignUps in Test_Race_SUCreateLogin, do not wait for accomplish, go to the next test and tokens became expired. Then workspace are continue to init in async projectors and 23 // async projectors are failed due of expired tokens -> wait for 30 second before error (projectros/actualizerErrorDelay) 24 25 // Test_Race_SUsignUpIn: sign up,sign in with existing logins & sign in with un-existing logins 26 func Test_Race_SUsignUpIn(t *testing.T) { 27 // t.Skip() 28 if testing.Short() { 29 t.Skip() 30 } 31 vit := it.NewVIT(t, &it.SharedConfig_App1) 32 defer vit.TearDown() 33 34 wg := &sync.WaitGroup{} 35 logins := make(chan it.Login, loginCnt) 36 for i := 0; i < loginCnt; i++ { 37 wg.Add(1) 38 go func() { 39 defer wg.Done() 40 login := vit.SignUp(fmt.Sprintf("login%s", strconv.Itoa(vit.NextNumber())), "1", istructs.AppQName_test1_app1) 41 logins <- login 42 }() 43 } 44 wg.Wait() 45 close(logins) 46 47 wgin := &sync.WaitGroup{} 48 for login := range logins { 49 wgin.Add(1) 50 go func(login it.Login) { 51 defer wgin.Done() 52 vit.SignIn(login, it.DoNotFailOnTimeout()) 53 }(login) 54 } 55 wgin.Wait() 56 }