add avatar inorder to view code on github
This commit is contained in:
parent
17da2fd2e3
commit
8e47ae2102
2 changed files with 171 additions and 0 deletions
35
modules/avatar/avatar_test.go
Normal file
35
modules/avatar/avatar_test.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package avatar
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestFetch(t *testing.T) {
|
||||
hash := HashEmail("ssx205@gmail.com")
|
||||
avatar := New(hash, "./")
|
||||
//avatar.Update()
|
||||
avatar.UpdateTimeout(time.Millisecond * 200)
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
|
||||
func TestFetchMany(t *testing.T) {
|
||||
log.Println("start")
|
||||
var n = 50
|
||||
ch := make(chan bool, n)
|
||||
for i := 0; i < n; i++ {
|
||||
go func(i int) {
|
||||
hash := HashEmail(strconv.Itoa(i) + "ssx205@gmail.com")
|
||||
avatar := New(hash, "./")
|
||||
avatar.Update()
|
||||
log.Println("finish", hash)
|
||||
ch <- true
|
||||
}(i)
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
<-ch
|
||||
}
|
||||
log.Println("end")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue