integrate redis engine.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-05-02 19:42:21 +08:00
parent 8df5c63860
commit 03ab8eeac7
12 changed files with 131 additions and 112 deletions

View File

@ -1,4 +1,4 @@
package gorush package config
import ( import (
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"

View File

@ -1,4 +1,4 @@
package gorush package config
import ( import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"

View File

@ -3,13 +3,14 @@ package gorush
import ( import (
"crypto/tls" "crypto/tls"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/appleboy/gorush/gorush/config"
apns "github.com/sideshow/apns2" apns "github.com/sideshow/apns2"
"gopkg.in/redis.v3" "gopkg.in/redis.v3"
) )
var ( var (
// PushConf is gorush config // PushConf is gorush config
PushConf ConfYaml PushConf config.ConfYaml
// QueueNotification is chan type // QueueNotification is chan type
QueueNotification chan PushNotification QueueNotification chan PushNotification
// CertificatePemIos is ios certificate file // CertificatePemIos is ios certificate file

View File

@ -2,6 +2,7 @@ package gorush
import ( import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/appleboy/gorush/gorush/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing" "testing"
) )
@ -34,7 +35,7 @@ func TestSetLogOut(t *testing.T) {
} }
func TestInitDefaultLog(t *testing.T) { func TestInitDefaultLog(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
// no errors on default config // no errors on default config
assert.Nil(t, InitLog()) assert.Nil(t, InitLog())
@ -45,7 +46,7 @@ func TestInitDefaultLog(t *testing.T) {
} }
func TestAccessLevel(t *testing.T) { func TestAccessLevel(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Log.AccessLevel = "invalid" PushConf.Log.AccessLevel = "invalid"
@ -53,7 +54,7 @@ func TestAccessLevel(t *testing.T) {
} }
func TestErrorLevel(t *testing.T) { func TestErrorLevel(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Log.ErrorLevel = "invalid" PushConf.Log.ErrorLevel = "invalid"
@ -61,7 +62,7 @@ func TestErrorLevel(t *testing.T) {
} }
func TestAccessLogPath(t *testing.T) { func TestAccessLogPath(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Log.AccessLog = "logs/access.log" PushConf.Log.AccessLog = "logs/access.log"
@ -69,7 +70,7 @@ func TestAccessLogPath(t *testing.T) {
} }
func TestErrorLogPath(t *testing.T) { func TestErrorLogPath(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Log.ErrorLog = "logs/error.log" PushConf.Log.ErrorLog = "logs/error.log"

View File

@ -2,6 +2,7 @@ package gorush
import ( import (
"encoding/json" "encoding/json"
"github.com/appleboy/gorush/gorush/config"
"github.com/buger/jsonparser" "github.com/buger/jsonparser"
"github.com/google/go-gcm" "github.com/google/go-gcm"
"github.com/sideshow/apns2" "github.com/sideshow/apns2"
@ -13,7 +14,7 @@ import (
) )
func TestDisabledAndroidIosConf(t *testing.T) { func TestDisabledAndroidIosConf(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
err := CheckPushConf() err := CheckPushConf()
@ -22,7 +23,7 @@ func TestDisabledAndroidIosConf(t *testing.T) {
} }
func TestMissingIOSCertificate(t *testing.T) { func TestMissingIOSCertificate(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.PemKeyPath = "" PushConf.Ios.PemKeyPath = ""
@ -34,7 +35,7 @@ func TestMissingIOSCertificate(t *testing.T) {
} }
func TestMissingAndroidAPIKey(t *testing.T) { func TestMissingAndroidAPIKey(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = "" PushConf.Android.APIKey = ""
@ -46,7 +47,7 @@ func TestMissingAndroidAPIKey(t *testing.T) {
} }
func TestCorrectConf(t *testing.T) { func TestCorrectConf(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = "xxxxx" PushConf.Android.APIKey = "xxxxx"
@ -217,7 +218,7 @@ func TestAndroidNotificationStructure(t *testing.T) {
} }
func TestPushToIOS(t *testing.T) { func TestPushToIOS(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem" PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem"
@ -235,7 +236,7 @@ func TestPushToIOS(t *testing.T) {
} }
func TestPushToAndroidWrongAPIKey(t *testing.T) { func TestPushToAndroidWrongAPIKey(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") + "a" PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") + "a"
@ -251,7 +252,7 @@ func TestPushToAndroidWrongAPIKey(t *testing.T) {
} }
func TestPushToAndroidWrongToken(t *testing.T) { func TestPushToAndroidWrongToken(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
@ -267,7 +268,7 @@ func TestPushToAndroidWrongToken(t *testing.T) {
} }
func TestPushToAndroidRightTokenForJSONLog(t *testing.T) { func TestPushToAndroidRightTokenForJSONLog(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
@ -287,7 +288,7 @@ func TestPushToAndroidRightTokenForJSONLog(t *testing.T) {
} }
func TestPushToAndroidRightTokenForStringLog(t *testing.T) { func TestPushToAndroidRightTokenForStringLog(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
@ -305,7 +306,7 @@ func TestPushToAndroidRightTokenForStringLog(t *testing.T) {
} }
func TestOverwriteAndroidAPIKey(t *testing.T) { func TestOverwriteAndroidAPIKey(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")
@ -325,7 +326,7 @@ func TestOverwriteAndroidAPIKey(t *testing.T) {
} }
func TestSenMultipleNotifications(t *testing.T) { func TestSenMultipleNotifications(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
InitWorkers(2, 2) InitWorkers(2, 2)
@ -360,7 +361,7 @@ func TestSenMultipleNotifications(t *testing.T) {
} }
func TestDisabledAndroidNotifications(t *testing.T) { func TestDisabledAndroidNotifications(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem" PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem"
@ -393,7 +394,7 @@ func TestDisabledAndroidNotifications(t *testing.T) {
} }
func TestDisabledIosNotifications(t *testing.T) { func TestDisabledIosNotifications(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = false PushConf.Ios.Enabled = false
PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem" PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem"
@ -426,7 +427,7 @@ func TestDisabledIosNotifications(t *testing.T) {
} }
func TestMissingIosCertificate(t *testing.T) { func TestMissingIosCertificate(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.PemKeyPath = "test" PushConf.Ios.PemKeyPath = "test"
@ -436,7 +437,7 @@ func TestMissingIosCertificate(t *testing.T) {
} }
func TestAPNSClientDevHost(t *testing.T) { func TestAPNSClientDevHost(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem" PushConf.Ios.PemKeyPath = "../certificate/certificate-valid.pem"
@ -446,7 +447,7 @@ func TestAPNSClientDevHost(t *testing.T) {
} }
func TestAPNSClientProdHost(t *testing.T) { func TestAPNSClientProdHost(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Ios.Enabled = true PushConf.Ios.Enabled = true
PushConf.Ios.Production = true PushConf.Ios.Production = true
@ -521,7 +522,7 @@ func TestGCMMessage(t *testing.T) {
} }
func TestCheckAndroidMessage(t *testing.T) { func TestCheckAndroidMessage(t *testing.T) {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Android.Enabled = true PushConf.Android.Enabled = true
PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY") PushConf.Android.APIKey = os.Getenv("ANDROID_API_KEY")

View File

@ -2,6 +2,7 @@ package gorush
import ( import (
"github.com/appleboy/gofight" "github.com/appleboy/gofight"
"github.com/appleboy/gorush/gorush/config"
"github.com/buger/jsonparser" "github.com/buger/jsonparser"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -15,7 +16,7 @@ import (
var goVersion = runtime.Version() var goVersion = runtime.Version()
func initTest() { func initTest() {
PushConf = BuildDefaultPushConf() PushConf = config.BuildDefaultPushConf()
PushConf.Core.Mode = "test" PushConf.Core.Mode = "test"
} }

View File

@ -2,6 +2,7 @@ package gorush
import ( import (
"github.com/appleboy/gorush/gorush/storage/memory" "github.com/appleboy/gorush/gorush/storage/memory"
"github.com/appleboy/gorush/gorush/storage/redis"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/http" "net/http"
) )
@ -32,8 +33,9 @@ func InitAppStatus() {
switch PushConf.Stat.Engine { switch PushConf.Stat.Engine {
case "memory": case "memory":
StatStorage = memory.New() StatStorage = memory.New()
// case "redis": case "redis":
// initRedis() StatStorage = redis.New(PushConf)
StatStorage.Init()
// case "boltdb": // case "boltdb":
// initBoltDB() // initBoltDB()
default: default:

View File

@ -90,29 +90,32 @@ func TestStatForMemoryEngine(t *testing.T) {
// assert.Error(t, err) // assert.Error(t, err)
// } // }
// func TestStatForRedisEngine(t *testing.T) { func TestStatForRedisEngine(t *testing.T) {
// var val int64 var val int64
// PushConf.Stat.Engine = "redis" PushConf.Stat.Engine = "redis"
// PushConf.Stat.Redis.Addr = "localhost:6379" PushConf.Stat.Redis.Addr = "localhost:6379"
// InitAppStatus() InitAppStatus()
// addTotalCount(10) StatStorage.Init()
// addIosSuccess(20) StatStorage.Reset()
// addIosError(30)
// addAndroidSuccess(40)
// addAndroidError(50)
// val = getTotalCount() StatStorage.AddTotalCount(100)
// assert.Equal(t, int64(10), val) StatStorage.AddIosSuccess(200)
// val = getIosSuccess() StatStorage.AddIosError(300)
// assert.Equal(t, int64(20), val) StatStorage.AddAndroidSuccess(400)
// val = getIosError() StatStorage.AddAndroidError(500)
// assert.Equal(t, int64(30), val)
// val = getAndroidSuccess() val = StatStorage.GetTotalCount()
// assert.Equal(t, int64(40), val) assert.Equal(t, int64(100), val)
// val = getAndroidError() val = StatStorage.GetIosSuccess()
// assert.Equal(t, int64(50), val) assert.Equal(t, int64(200), val)
// } val = StatStorage.GetIosError()
assert.Equal(t, int64(300), val)
val = StatStorage.GetAndroidSuccess()
assert.Equal(t, int64(400), val)
val = StatStorage.GetAndroidError()
assert.Equal(t, int64(500), val)
}
// func TestDefaultEngine(t *testing.T) { // func TestDefaultEngine(t *testing.T) {
// var val int64 // var val int64

View File

@ -2,6 +2,8 @@ package gorush
// Storage interface // Storage interface
type Storage interface { type Storage interface {
Init() error
Reset()
AddTotalCount(int64) AddTotalCount(int64)
AddIosSuccess(int64) AddIosSuccess(int64)
AddIosError(int64) AddIosError(int64)

View File

@ -34,6 +34,13 @@ type Storage struct {
stat *statApp stat *statApp
} }
func (s *Storage) Init() error {
return nil
}
func (s *Storage) Reset() {
}
func (s *Storage) AddTotalCount(count int64) { func (s *Storage) AddTotalCount(count int64) {
atomic.AddInt64(&s.stat.TotalCount, count) atomic.AddInt64(&s.stat.TotalCount, count)
} }

View File

@ -1,18 +1,26 @@
package redis package redis
import ( import (
"github.com/appleboy/gorush/gorush" "github.com/appleboy/gorush/gorush/config"
"gopkg.in/redis.v3" "gopkg.in/redis.v3"
"log" "log"
"strconv" "strconv"
) )
// Stat variable for redis
const (
TotalCountKey = "gorush-total-count"
IosSuccessKey = "gorush-ios-success-count"
IosErrorKey = "gorush-ios-error-count"
AndroidSuccessKey = "gorush-android-success-count"
AndroidErrorKey = "gorush-android-error-count"
)
var RedisClient *redis.Client var RedisClient *redis.Client
// Storage implements the storage interface for gorush (https://github.com/appleboy/gorush) // Storage implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config gorush.ConfYaml, stat gorush.StatusApp) *Storage { func New(config config.ConfYaml) *Storage {
return &Storage{ return &Storage{
stat: stat,
config: config, config: config,
} }
} }
@ -23,11 +31,10 @@ func getRedisInt64Result(key string, count *int64) {
} }
type Storage struct { type Storage struct {
config gorush.ConfYaml config config.ConfYaml
stat gorush.StatusApp
} }
func (s *Storage) initRedis() error { func (s *Storage) Init() error {
RedisClient = redis.NewClient(&redis.Options{ RedisClient = redis.NewClient(&redis.Options{
Addr: s.config.Stat.Redis.Addr, Addr: s.config.Stat.Redis.Addr,
Password: s.config.Stat.Redis.Password, Password: s.config.Stat.Redis.Password,
@ -43,79 +50,73 @@ func (s *Storage) initRedis() error {
return err return err
} }
s.stat.TotalCount = s.getTotalCount()
s.stat.Ios.PushSuccess = s.getIosSuccess()
s.stat.Ios.PushError = s.getIosError()
s.stat.Android.PushSuccess = s.getAndroidSuccess()
s.stat.Android.PushError = s.getAndroidError()
return nil return nil
} }
func (s *Storage) resetRedis() { func (s *Storage) Reset() {
RedisClient.Set(gorush.TotalCountKey, strconv.Itoa(0), 0) RedisClient.Set(TotalCountKey, strconv.Itoa(0), 0)
RedisClient.Set(gorush.IosSuccessKey, strconv.Itoa(0), 0) RedisClient.Set(IosSuccessKey, strconv.Itoa(0), 0)
RedisClient.Set(gorush.IosErrorKey, strconv.Itoa(0), 0) RedisClient.Set(IosErrorKey, strconv.Itoa(0), 0)
RedisClient.Set(gorush.AndroidSuccessKey, strconv.Itoa(0), 0) RedisClient.Set(AndroidSuccessKey, strconv.Itoa(0), 0)
RedisClient.Set(gorush.AndroidErrorKey, strconv.Itoa(0), 0) RedisClient.Set(AndroidErrorKey, strconv.Itoa(0), 0)
} }
func (s *Storage) addTotalCount(count int64) { func (s *Storage) AddTotalCount(count int64) {
total := s.getTotalCount() + count total := s.GetTotalCount() + count
RedisClient.Set(gorush.TotalCountKey, strconv.Itoa(int(total)), 0) RedisClient.Set(TotalCountKey, strconv.Itoa(int(total)), 0)
} }
func (s *Storage) addIosSuccess(count int64) { func (s *Storage) AddIosSuccess(count int64) {
total := s.getIosSuccess() + count total := s.GetIosSuccess() + count
RedisClient.Set(gorush.IosSuccessKey, strconv.Itoa(int(total)), 0) RedisClient.Set(IosSuccessKey, strconv.Itoa(int(total)), 0)
} }
func (s *Storage) addIosError(count int64) { func (s *Storage) AddIosError(count int64) {
total := s.getIosError() + count total := s.GetIosError() + count
RedisClient.Set(gorush.IosErrorKey, strconv.Itoa(int(total)), 0) RedisClient.Set(IosErrorKey, strconv.Itoa(int(total)), 0)
} }
func (s *Storage) addAndroidSuccess(count int64) { func (s *Storage) AddAndroidSuccess(count int64) {
total := s.getAndroidSuccess() + count total := s.GetAndroidSuccess() + count
RedisClient.Set(gorush.AndroidSuccessKey, strconv.Itoa(int(total)), 0) RedisClient.Set(AndroidSuccessKey, strconv.Itoa(int(total)), 0)
} }
func (s *Storage) addAndroidError(count int64) { func (s *Storage) AddAndroidError(count int64) {
total := s.getAndroidError() + count total := s.GetAndroidError() + count
RedisClient.Set(gorush.AndroidErrorKey, strconv.Itoa(int(total)), 0) RedisClient.Set(AndroidErrorKey, strconv.Itoa(int(total)), 0)
} }
func (s *Storage) getTotalCount() int64 { func (s *Storage) GetTotalCount() int64 {
var count int64 var count int64
getRedisInt64Result(gorush.TotalCountKey, &count) getRedisInt64Result(TotalCountKey, &count)
return count return count
} }
func (s *Storage) getIosSuccess() int64 { func (s *Storage) GetIosSuccess() int64 {
var count int64 var count int64
getRedisInt64Result(gorush.IosSuccessKey, &count) getRedisInt64Result(IosSuccessKey, &count)
return count return count
} }
func (s *Storage) getIosError() int64 { func (s *Storage) GetIosError() int64 {
var count int64 var count int64
getRedisInt64Result(gorush.IosErrorKey, &count) getRedisInt64Result(IosErrorKey, &count)
return count return count
} }
func (s *Storage) getAndroidSuccess() int64 { func (s *Storage) GetAndroidSuccess() int64 {
var count int64 var count int64
getRedisInt64Result(gorush.AndroidSuccessKey, &count) getRedisInt64Result(AndroidSuccessKey, &count)
return count return count
} }
func (s *Storage) getAndroidError() int64 { func (s *Storage) GetAndroidError() int64 {
var count int64 var count int64
getRedisInt64Result(gorush.AndroidErrorKey, &count) getRedisInt64Result(AndroidErrorKey, &count)
return count return count
} }

View File

@ -1,17 +1,17 @@
package redis package redis
import ( import (
"github.com/appleboy/gorush/gorush" c "github.com/appleboy/gorush/gorush/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing" "testing"
) )
func TestRedisServerError(t *testing.T) { func TestRedisServerError(t *testing.T) {
config := gorush.BuildDefaultPushConf() config := c.BuildDefaultPushConf()
config.Stat.Redis.Addr = "localhost:6370" config.Stat.Redis.Addr = "localhost:6370"
redis := New(config, gorush.StatusApp{}) redis := New(config)
err := redis.initRedis() err := redis.Init()
assert.Error(t, err) assert.Error(t, err)
} }
@ -19,32 +19,32 @@ func TestRedisServerError(t *testing.T) {
func TestRedisEngine(t *testing.T) { func TestRedisEngine(t *testing.T) {
var val int64 var val int64
config := gorush.BuildDefaultPushConf() config := c.BuildDefaultPushConf()
redis := New(config, gorush.StatusApp{}) redis := New(config)
redis.initRedis() redis.Init()
redis.resetRedis() redis.Reset()
redis.addTotalCount(10) redis.AddTotalCount(10)
val = redis.getTotalCount() val = redis.GetTotalCount()
assert.Equal(t, int64(10), val) assert.Equal(t, int64(10), val)
redis.addTotalCount(10) redis.AddTotalCount(10)
val = redis.getTotalCount() val = redis.GetTotalCount()
assert.Equal(t, int64(20), val) assert.Equal(t, int64(20), val)
redis.addIosSuccess(20) redis.AddIosSuccess(20)
val = redis.getIosSuccess() val = redis.GetIosSuccess()
assert.Equal(t, int64(20), val) assert.Equal(t, int64(20), val)
redis.addIosError(30) redis.AddIosError(30)
val = redis.getIosError() val = redis.GetIosError()
assert.Equal(t, int64(30), val) assert.Equal(t, int64(30), val)
redis.addAndroidSuccess(40) redis.AddAndroidSuccess(40)
val = redis.getAndroidSuccess() val = redis.GetAndroidSuccess()
assert.Equal(t, int64(40), val) assert.Equal(t, int64(40), val)
redis.addAndroidError(50) redis.AddAndroidError(50)
val = redis.getAndroidError() val = redis.GetAndroidError()
assert.Equal(t, int64(50), val) assert.Equal(t, int64(50), val)
} }