fix lint error for gorush folder. (#275)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
acc83c1fa5
commit
e070248a11
|
@ -30,7 +30,10 @@ func TestWrongYAMLormat(t *testing.T) {
|
|||
}
|
||||
|
||||
// clean up
|
||||
defer os.Remove(filename)
|
||||
defer func() {
|
||||
err := os.Remove(filename)
|
||||
assert.Nil(t, err)
|
||||
}()
|
||||
|
||||
// parse JSON format error
|
||||
_, err := LoadConfYaml(filename)
|
||||
|
|
|
@ -67,11 +67,11 @@ func InitLog() error {
|
|||
}
|
||||
|
||||
// set logger
|
||||
if err := SetLogLevel(LogAccess, PushConf.Log.AccessLevel); err != nil {
|
||||
if err = SetLogLevel(LogAccess, PushConf.Log.AccessLevel); err != nil {
|
||||
return errors.New("Set access log level error: " + err.Error())
|
||||
}
|
||||
|
||||
if err := SetLogLevel(LogError, PushConf.Log.ErrorLevel); err != nil {
|
||||
if err = SetLogLevel(LogError, PushConf.Log.ErrorLevel); err != nil {
|
||||
return errors.New("Set error log level error: " + err.Error())
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ func getLogPushEntry(status, token string, req PushNotification, errPush error)
|
|||
errMsg = errPush.Error()
|
||||
}
|
||||
|
||||
if PushConf.Log.HideToken == true {
|
||||
if PushConf.Log.HideToken {
|
||||
token = hideToken(token, 10)
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ Retry:
|
|||
}
|
||||
}
|
||||
|
||||
if isError == true && retryCount < maxRetry {
|
||||
if isError && retryCount < maxRetry {
|
||||
retryCount++
|
||||
|
||||
// resend fail token
|
||||
|
|
|
@ -349,7 +349,8 @@ func TestDisabledIosNotifications(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = false
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
|
||||
PushConf.Android.Enabled = true
|
||||
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
|
||||
|
@ -394,8 +395,8 @@ func TestAPNSClientDevHost(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.p12"
|
||||
InitAPNSClient()
|
||||
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, apns2.HostDevelopment, ApnsClient.Host)
|
||||
}
|
||||
|
||||
|
@ -405,8 +406,8 @@ func TestAPNSClientProdHost(t *testing.T) {
|
|||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.Production = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, apns2.HostProduction, ApnsClient.Host)
|
||||
}
|
||||
|
||||
|
@ -415,8 +416,10 @@ func TestPushToIOS(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
InitAppStatus()
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
err = InitAppStatus()
|
||||
assert.Nil(t, err)
|
||||
|
||||
req := PushNotification{
|
||||
Tokens: []string{"11aa01229f15f0f0c52029d8cf8cd0aeaf2365fe4cebc4af26cd6d76b7919ef7"},
|
||||
|
|
|
@ -141,7 +141,7 @@ Retry:
|
|||
LogPush(SucceededPush, req.Tokens[k], req, nil)
|
||||
}
|
||||
|
||||
if isError == true && retryCount < maxRetry {
|
||||
if isError && retryCount < maxRetry {
|
||||
retryCount++
|
||||
|
||||
// resend fail token
|
||||
|
|
|
@ -29,7 +29,8 @@ func TestSenMultipleNotifications(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
|
||||
PushConf.Android.Enabled = true
|
||||
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
|
||||
|
@ -63,7 +64,8 @@ func TestDisabledAndroidNotifications(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
|
||||
PushConf.Android.Enabled = false
|
||||
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
|
||||
|
@ -97,7 +99,8 @@ func TestSyncModeForNotifications(t *testing.T) {
|
|||
|
||||
PushConf.Ios.Enabled = true
|
||||
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
|
||||
InitAPNSClient()
|
||||
err := InitAPNSClient()
|
||||
assert.Nil(t, err)
|
||||
|
||||
PushConf.Android.Enabled = true
|
||||
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
|
||||
|
|
|
@ -19,7 +19,8 @@ func TestStatForMemoryEngine(t *testing.T) {
|
|||
|
||||
var val int64
|
||||
PushConf.Stat.Engine = "memory"
|
||||
InitAppStatus()
|
||||
err := InitAppStatus()
|
||||
assert.Nil(t, err)
|
||||
|
||||
StatStorage.AddTotalCount(100)
|
||||
StatStorage.AddIosSuccess(200)
|
||||
|
@ -61,7 +62,8 @@ func TestStatForRedisEngine(t *testing.T) {
|
|||
var val int64
|
||||
PushConf.Stat.Engine = "redis"
|
||||
PushConf.Stat.Redis.Addr = "redis:6379"
|
||||
InitAppStatus()
|
||||
err := InitAppStatus()
|
||||
assert.Nil(t, err)
|
||||
|
||||
StatStorage.Init()
|
||||
StatStorage.Reset()
|
||||
|
@ -87,7 +89,8 @@ func TestStatForRedisEngine(t *testing.T) {
|
|||
func TestDefaultEngine(t *testing.T) {
|
||||
var val int64
|
||||
// defaul engine as memory
|
||||
InitAppStatus()
|
||||
err := InitAppStatus()
|
||||
assert.Nil(t, err)
|
||||
|
||||
StatStorage.Reset()
|
||||
|
||||
|
@ -137,7 +140,8 @@ func TestStatForBoltDBEngine(t *testing.T) {
|
|||
func TestStatForBuntDBEngine(t *testing.T) {
|
||||
var val int64
|
||||
PushConf.Stat.Engine = "buntdb"
|
||||
InitAppStatus()
|
||||
err := InitAppStatus()
|
||||
assert.Nil(t, err)
|
||||
|
||||
StatStorage.Reset()
|
||||
|
||||
|
|
Loading…
Reference in New Issue