|
@@ -3,6 +3,7 @@ package getuiV2 |
|
@@ -3,6 +3,7 @@ package getuiV2 |
3
|
import (
|
3
|
import (
|
4
|
"openapi/pkg/infrastructure/push"
|
4
|
"openapi/pkg/infrastructure/push"
|
5
|
"openapi/pkg/infrastructure/utils"
|
5
|
"openapi/pkg/infrastructure/utils"
|
|
|
6
|
+ "sync"
|
6
|
"testing"
|
7
|
"testing"
|
7
|
)
|
8
|
)
|
8
|
|
9
|
|
|
@@ -77,3 +78,29 @@ func TestGetuiPrd(t *testing.T) { |
|
@@ -77,3 +78,29 @@ func TestGetuiPrd(t *testing.T) { |
77
|
t.Fatal(err)
|
78
|
t.Fatal(err)
|
78
|
}
|
79
|
}
|
79
|
}
|
80
|
}
|
|
|
81
|
+
|
|
|
82
|
+func TestGetAuthToken(t *testing.T) {
|
|
|
83
|
+ var wg sync.WaitGroup
|
|
|
84
|
+ round := 100
|
|
|
85
|
+ notification := &GetuiNotification{}
|
|
|
86
|
+ var tokenMap = make(map[string]string)
|
|
|
87
|
+ notification.Init(
|
|
|
88
|
+ push.DebugModule(true),
|
|
|
89
|
+
|
|
|
90
|
+ push.AppId("WgrbaaStTk7JElrXOCgUg6"),
|
|
|
91
|
+ push.AppKey("FG5lbqVrHa5rS9NVfxNP7"),
|
|
|
92
|
+ push.AppMasterSecret("FW3jMNLJrRARYKv2iqA5H5"),
|
|
|
93
|
+ )
|
|
|
94
|
+ for i := 0; i < round; i++ {
|
|
|
95
|
+ wg.Add(1)
|
|
|
96
|
+ go func() {
|
|
|
97
|
+ defer wg.Done()
|
|
|
98
|
+ token, _ := notification.GetAuthToken()
|
|
|
99
|
+ tokenMap[token] = token
|
|
|
100
|
+ }()
|
|
|
101
|
+ }
|
|
|
102
|
+ wg.Wait()
|
|
|
103
|
+ if len(tokenMap) > 1 {
|
|
|
104
|
+ t.Fatalf("token want 1 get %v", len(tokenMap))
|
|
|
105
|
+ }
|
|
|
106
|
+} |