Skip to content

Commit 5979b87

Browse files
committed
TEST/MEDIUM: fix issue in gentype that prevented to run the tests for sections with dash
In xxx_data_test.go test strings are present but in xxx_test_go the list of test cases to run was empty.
1 parent 000cf7e commit 5979b87

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

config-parser/generate/config-file.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (c *ConfigFile) StringFiles(baseFolder string) {
285285
}
286286
usedNiceNames[niceName] = struct{}{}
287287
sectionName := " test"
288-
if sectionType == "global" {
288+
if sectionType == "global" || sectionType == "dynamic-update" {
289289
sectionName = ""
290290
}
291291
oneTest := "const " + niceName + " = `\n" + sectionType + sectionName + "\n" + " " + line + "\n`" + "\n"
@@ -308,8 +308,9 @@ func (c *ConfigFile) StringFiles(baseFolder string) {
308308
testName := cases.Title(language.Und, cases.NoLower).String(getNiceName(sectionName))
309309
testFile.WriteString(strings.Replace(testHeader, "TestWholeConfigsSections", "TestWholeConfigsSections"+testName, 1))
310310
sortedNames := []string{}
311+
sectionNameWithoutDash := strings.ReplaceAll(sectionName, "-", "")
311312
for name := range usedNiceNames {
312-
if strings.HasPrefix(name, sectionName) {
313+
if strings.HasPrefix(name, sectionNameWithoutDash) {
313314
sortedNames = append(sortedNames, name)
314315
}
315316
}

config-parser/tests/integration/fcgi-app_test.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config-parser/tests/integration/log-forward_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)