mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 05:35:08 +08:00
fix test file.
This commit is contained in:
parent
e882519162
commit
1995cefdd8
@ -1,27 +1,28 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoadLogConfig(t *testing.T) {
|
func TestLoadLogConfig(t *testing.T) {
|
||||||
var log Log
|
var log Log
|
||||||
err := LoadConfig("../../../config/log.yml", "IMENV_LOG", &log)
|
err := Load("../../../config/log.yml", "IMENV_LOG", "", &log)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, "../../../../logs/", log.StorageLocation)
|
assert.Equal(t, "../../../../logs/", log.StorageLocation)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadMinioConfig(t *testing.T) {
|
func TestLoadMinioConfig(t *testing.T) {
|
||||||
var storageConfig Minio
|
var storageConfig Minio
|
||||||
err := LoadConfig("../../../config/minio.yml", "IMENV_MINIO", &storageConfig)
|
err := Load("../../../config/minio.yml", "IMENV_MINIO", "", &storageConfig)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, "openim", storageConfig.Bucket)
|
assert.Equal(t, "openim", storageConfig.Bucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadWebhooksConfig(t *testing.T) {
|
func TestLoadWebhooksConfig(t *testing.T) {
|
||||||
var webhooks Webhooks
|
var webhooks Webhooks
|
||||||
err := LoadConfig("../../../config/webhooks.yml", "IMENV_WEBHOOKS", &webhooks)
|
err := Load("../../../config/webhooks.yml", "IMENV_WEBHOOKS", "", &webhooks)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, 5, webhooks.BeforeAddBlack.Timeout)
|
assert.Equal(t, 5, webhooks.BeforeAddBlack.Timeout)
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ func TestLoadWebhooksConfig(t *testing.T) {
|
|||||||
|
|
||||||
func TestLoadOpenIMRpcUserConfig(t *testing.T) {
|
func TestLoadOpenIMRpcUserConfig(t *testing.T) {
|
||||||
var user User
|
var user User
|
||||||
err := LoadConfig("../../../config/openim-rpc-user.yml", "IMENV_OPENIM_RPC_USER", &user)
|
err := Load("../../../config/openim-rpc-user.yml", "IMENV_OPENIM_RPC_USER", "", &user)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
//export IMENV_OPENIM_RPC_USER_RPC_LISTENIP="0.0.0.0"
|
//export IMENV_OPENIM_RPC_USER_RPC_LISTENIP="0.0.0.0"
|
||||||
assert.Equal(t, "0.0.0.0", user.RPC.ListenIP)
|
assert.Equal(t, "0.0.0.0", user.RPC.ListenIP)
|
||||||
@ -39,14 +40,14 @@ func TestLoadOpenIMRpcUserConfig(t *testing.T) {
|
|||||||
|
|
||||||
func TestLoadNotificationConfig(t *testing.T) {
|
func TestLoadNotificationConfig(t *testing.T) {
|
||||||
var noti Notification
|
var noti Notification
|
||||||
err := LoadConfig("../../../config/notification.yml", "IMENV_NOTIFICATION", ¬i)
|
err := Load("../../../config/notification.yml", "IMENV_NOTIFICATION", "", ¬i)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, "Your friend's profile has been changed", noti.FriendRemarkSet.OfflinePush.Title)
|
assert.Equal(t, "Your friend's profile has been changed", noti.FriendRemarkSet.OfflinePush.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadOpenIMThirdConfig(t *testing.T) {
|
func TestLoadOpenIMThirdConfig(t *testing.T) {
|
||||||
var third Third
|
var third Third
|
||||||
err := LoadConfig("../../../config/openim-rpc-third.yml", "IMENV_OPENIM_RPC_THIRD", &third)
|
err := Load("../../../config/openim-rpc-third.yml", "IMENV_OPENIM_RPC_THIRD", "", &third)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, "enabled", third.Object.Enable)
|
assert.Equal(t, "enabled", third.Object.Enable)
|
||||||
assert.Equal(t, "https://oss-cn-chengdu.aliyuncs.com", third.Object.Oss.Endpoint)
|
assert.Equal(t, "https://oss-cn-chengdu.aliyuncs.com", third.Object.Oss.Endpoint)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user