From 95ed5799d19352bc5a4562c31b99df8bb516af2c Mon Sep 17 00:00:00 2001 From: chris-sun-star Date: Thu, 11 Nov 2021 20:00:21 +0800 Subject: [PATCH] fix test --- Makefile | 2 +- Makefile.common | 2 +- config/config_module_test.go | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f1ce8d5..366efa8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include Makefile.common -.PHONY: build monagent +.PHONY: all test clean build monagent default: clean fmt build diff --git a/Makefile.common b/Makefile.common index b73d42e..10854fc 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,6 +1,6 @@ PROJECT=obagent PROCESSOR=2 -VERSION=0.1 +VERSION=1.0 PWD ?= $(shell pwd) GO := GO111MODULE=on GOPROXY=https://mirrors.aliyun.com/goproxy/,direct go diff --git a/config/config_module_test.go b/config/config_module_test.go index 4b1a4e9..ee981a5 100644 --- a/config/config_module_test.go +++ b/config/config_module_test.go @@ -67,6 +67,18 @@ configs: value: 10s - key: foo.bar.bar 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 { @@ -116,6 +128,8 @@ func _init(t *testing.T) string { moduleConfigDir := filepath.Join(tempDir, "module_config") err := os.MkdirAll(moduleConfigDir, 0755) assert.Nil(t, err) + err = ioutil.WriteFile(filepath.Join(moduleConfigDir, "foo.yaml"), []byte(fooModuleYaml), 0755) + assert.Nil(t, err) configPropertiesDir := filepath.Join(tempDir, "config_properties") err = os.MkdirAll(configPropertiesDir, 0755) @@ -197,7 +211,6 @@ func TestModuleConfigCallback_Success(t *testing.T) { So(fooServer.Foo.Bar.Bar, ShouldEqual, 3306) So(fooServer.Foo.Bar.Duration, ShouldEqual, "10s") }) - }) } -- GitLab