提交 95ed5799 编写于 作者: C chris-sun-star

fix test

上级 29775e5f
include Makefile.common include Makefile.common
.PHONY: build monagent .PHONY: all test clean build monagent
default: clean fmt build default: clean fmt build
......
PROJECT=obagent PROJECT=obagent
PROCESSOR=2 PROCESSOR=2
VERSION=0.1 VERSION=1.0
PWD ?= $(shell pwd) PWD ?= $(shell pwd)
GO := GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/,direct go GO := GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/,direct go
......
...@@ -67,6 +67,18 @@ configs: ...@@ -67,6 +67,18 @@ configs:
value: 10s value: 10s
- key: foo.bar.bar - key: foo.bar.bar
value: 3306` value: 3306`
fooModuleYaml = `modules:
-
module: foo
moduleType: fooType
process: ocp_mgragent
config:
foo: ${foo.foo}
fooNoDefine: ${foo.not.defined}
bar:
bar: ${foo.bar.bar}
duration: ${foo.bar.duration}`
) )
func _init(t *testing.T) string { func _init(t *testing.T) string {
...@@ -115,6 +127,8 @@ func _init(t *testing.T) string { ...@@ -115,6 +127,8 @@ func _init(t *testing.T) string {
moduleConfigDir := filepath.Join(tempDir, "module_config") moduleConfigDir := filepath.Join(tempDir, "module_config")
err := os.MkdirAll(moduleConfigDir, 0755) err := os.MkdirAll(moduleConfigDir, 0755)
assert.Nil(t, err)
err = ioutil.WriteFile(filepath.Join(moduleConfigDir, "foo.yaml"), []byte(fooModuleYaml), 0755)
assert.Nil(t, err) assert.Nil(t, err)
configPropertiesDir := filepath.Join(tempDir, "config_properties") configPropertiesDir := filepath.Join(tempDir, "config_properties")
...@@ -197,7 +211,6 @@ func TestModuleConfigCallback_Success(t *testing.T) { ...@@ -197,7 +211,6 @@ func TestModuleConfigCallback_Success(t *testing.T) {
So(fooServer.Foo.Bar.Bar, ShouldEqual, 3306) So(fooServer.Foo.Bar.Bar, ShouldEqual, 3306)
So(fooServer.Foo.Bar.Duration, ShouldEqual, "10s") So(fooServer.Foo.Bar.Duration, ShouldEqual, "10s")
}) })
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册