config: add a test for config.toml.example (#23766)

This commit is contained in:
rebelice
2021-04-02 07:51:24 +08:00
committed by GitHub
parent 503841f5cd
commit e248a26eea

View File

@ -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)
}
}
}