feat(conf): updata conf test

This commit is contained in:
Sodesnei 2021-10-10 14:05:01 +08:00
parent 4d9558c21f
commit febd5501c4
1 changed files with 2 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package conf package conf
import ( import (
"fmt"
"testing" "testing"
"github.com/spf13/viper" "github.com/spf13/viper"
@ -26,18 +25,11 @@ func TestConf(t *testing.T) {
} }
func TestMiddleConf(t *testing.T) { func TestMiddleConf(t *testing.T) {
ct := viper.GetStringMap("plugins-control") ct := viper.GetStringSlice("plugins-control.logcontext")
require.Equal(t, ct, []string{"logMiddle"})
fmt.Println(ct)
d := viper.GetInt("middleware-driver.driverCount") d := viper.GetInt("middleware-driver.driverCount")
require.Equal(t, d, 1000) require.Equal(t, d, 1000)
c := viper.GetInt("middleware-driver.middleConsumerCount") c := viper.GetInt("middleware-driver.middleConsumerCount")
require.Equal(t, c, 5) require.Equal(t, c, 5)
p := viper.GetStringMap("plugins-control")
for key, val := range p {
fmt.Println(key, val)
}
// fmt.Println(p)
} }