From ab8baaccf71bc8de2dbd630017e0bc4159c4bfb0 Mon Sep 17 00:00:00 2001 From: lucklove Date: Wed, 7 Apr 2021 11:10:31 +0800 Subject: [PATCH] Fix test --- components/dm/ansible/import_test.go | 5 +++++ pkg/cluster/spec/prometheus.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/dm/ansible/import_test.go b/components/dm/ansible/import_test.go index 66109bcd3d..51711695f6 100644 --- a/components/dm/ansible/import_test.go +++ b/components/dm/ansible/import_test.go @@ -164,6 +164,7 @@ func TestImportFromAnsible(t *testing.T) { DeployDir: "", LogDir: "/home/tidb/deploy/log", Config: map[string]interface{}{"log-level": "info"}, + Imported: true, } assert.Equal(expectedMaster, master) @@ -180,6 +181,7 @@ func TestImportFromAnsible(t *testing.T) { DeployDir: "/home/tidb/deploy", LogDir: "/home/tidb/deploy/log", Config: map[string]interface{}{"log-level": "info"}, + Imported: true, } worker := topo.Workers[0] @@ -199,6 +201,7 @@ func TestImportFromAnsible(t *testing.T) { DeployDir: "", DataDir: "/home/tidb/deploy/data.alertmanager", LogDir: "/home/tidb/deploy/log", + Imported: true, } assert.Equal(expectedAlter, aler) @@ -212,6 +215,7 @@ func TestImportFromAnsible(t *testing.T) { Port: 3001, Username: "foo", Password: "bar", + Imported: true, } assert.Equal(expectedGrafana, grafana) @@ -225,6 +229,7 @@ func TestImportFromAnsible(t *testing.T) { DataDir: "/home/tidb/deploy/prometheus.data.metrics", LogDir: "/home/tidb/deploy/log", Port: 9090, + Imported: true, } assert.Equal(expectedMonitor, monitor) diff --git a/pkg/cluster/spec/prometheus.go b/pkg/cluster/spec/prometheus.go index fad408e7de..3b6703b11d 100644 --- a/pkg/cluster/spec/prometheus.go +++ b/pkg/cluster/spec/prometheus.go @@ -372,7 +372,7 @@ func (i *MonitorInstance) initRules(ctx context.Context, e ctxt.Executor, spec * "mkdir -p %[1]s/conf", `find %[1]s/conf -type f -name "*.rules.yml" -delete`, `find %[1]s/bin/prometheus -maxdepth 1 -type f -name "*.rules.yml" -exec cp {} %[1]s/conf/ \;`, - `find %[1]s/conf -maxdepth 1 -type f -name "*.rules.yml" -exec sed -i "s/ENV_LABELS_ENV/%[2]s/g" {} \;`, + `find %[1]s/conf -maxdepth 1 -type f -name "*.rules.yml" -exec sed -i -e "s/ENV_LABELS_ENV/%[2]s/g" {} \;`, } _, stderr, err := e.Execute(ctx, fmt.Sprintf(strings.Join(cmds, " && "), paths.Deploy, clusterName), false) if err != nil {