config init now leaves out the test sources unless given --all
A section tagged init:"hidden" isn't written to the file config init generates; fts_mock and sleeper are. config init --all writes them too. They still load, and the config commands read and set them as before.
This commit is contained in:
1 parent
f467c6c7da
commit
b0f93fd437
8 files changed
+131
-21
No files matched your search
@@ -288,6 +288,26 @@ func TestConcreteSourceSections(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// InitDefaults leaves out the sections tagged init:"hidden" unless asked.
|
||||
func TestInitDefaults(t *testing.T) {
|
||||
all := InitDefaults(true)
|
||||
shown := InitDefaults(false)
|
||||
if all["sources.sleeper.enabled"] != false ||
|
||||
all["sources.fts_mock.interval"] != "10m0s" {
|
||||
t.Errorf("all = %v; want the test sources' defaults", all)
|
||||
}
|
||||
for key := range all {
|
||||
hidden := strings.HasPrefix(key, "sources.fts_mock.") ||
|
||||
strings.HasPrefix(key, "sources.sleeper.")
|
||||
if _, found := shown[key]; found == hidden {
|
||||
t.Errorf("%s: in the generated defaults = %v", key, found)
|
||||
}
|
||||
}
|
||||
if shown["sources.eu_supply.base_url"] != "https://uk.eu-supply.com" {
|
||||
t.Errorf("eu_supply missing: %v", shown)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEUSupplySection(t *testing.T) {
|
||||
conf := defaultConfig(t)
|
||||
got := conf.Sources.EUSupply
|
||||
|
||||
Reference in new issue
Block a user