Skip to content

Commit

Permalink
fix test after contprof is enabled by default (#131)
Browse files Browse the repository at this point in the history
* empty

Signed-off-by: Zhenchi <[email protected]>

* fix test

Signed-off-by: Zhenchi <[email protected]>

* try bad format

Signed-off-by: Zhenchi <[email protected]>

* try bad lint

Signed-off-by: Zhenchi <[email protected]>

* fix all

Signed-off-by: Zhenchi <[email protected]>
  • Loading branch information
zhongzc authored Apr 29, 2022
1 parent c702bf0 commit 029a112
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ key-path = "ngm.key"`
require.NotNil(t, cfg)
data, err := json.Marshal(cfg)
require.NoError(t, err)
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))

go ReloadRoutine(context.Background(), cfgFileName, cfg)
time.Sleep(time.Millisecond * 10)
Expand All @@ -109,7 +109,7 @@ path = "data1"`
require.Equal(t, getCfg(), globalCfg)
data, err = json.Marshal(globalCfg)
require.NoError(t, err)
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))

cfgData = ``
err = ioutil.WriteFile(cfgFileName, []byte(cfgData), 0666)
Expand All @@ -119,7 +119,7 @@ path = "data1"`
time.Sleep(time.Millisecond * 10)
data, err = json.Marshal(GetGlobalConfig())
require.NoError(t, err)
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))
require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data))
}

func TestConfigValid(t *testing.T) {
Expand Down

0 comments on commit 029a112

Please sign in to comment.