Make sure the number of config options and number of flags match
(t *testing.T)
| 149 | |
| 150 | // Make sure the number of config options and number of flags match |
| 151 | func TestAllConfigOptionsAsFlags(t *testing.T) { |
| 152 | cfg := NewEmptyStartupConfig() |
| 153 | cfgFieldsNum := countFields(cfg) |
| 154 | flagsNum := registerConfigFlags(&cfg, flag.NewFlagSet("test", flag.ContinueOnError)) |
| 155 | assert.Lenf(t, flagsNum, cfgFieldsNum, "Number of cli flags and startup config properties did not match! Did you forget to add a new config option in registerConfigFlags?") |
| 156 | } |
| 157 | |
| 158 | func countFields(cfg interface{}) (fields int) { |
| 159 | rField := reflect.ValueOf(cfg) |
nothing calls this directly
no test coverage detected