From e248a26eea971997ea4eb3ef9bacb00e369f2dea Mon Sep 17 00:00:00 2001 From: rebelice Date: Fri, 2 Apr 2021 07:51:24 +0800 Subject: [PATCH] config: add a test for `config.toml.example` (#23766) --- config/config_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/config_test.go b/config/config_test.go index 25fea0d1c0..caeb8ef7e4 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -596,3 +596,17 @@ func (s *testConfigSuite) TestTcpNoDelay(c *C) { //check default value c.Assert(c1.Performance.TCPNoDelay, Equals, true) } + +func (s *testConfigSuite) TestConfigExample(c *C) { + conf := NewConfig() + _, localFile, _, _ := runtime.Caller(0) + configFile := filepath.Join(filepath.Dir(localFile), "config.toml.example") + metaData, err := toml.DecodeFile(configFile, conf) + c.Assert(err, IsNil) + keys := metaData.Keys() + for _, key := range keys { + for _, s := range key { + c.Assert(ContainHiddenConfig(s), IsFalse) + } + } +}