Skip to content

Commit 106400d

Browse files
committed
WIP > XPack, Generator: Tests: Fix incorrect Test.BaseFilename()
1 parent f063112 commit 106400d

File tree

1 file changed

+7
-3
lines changed
  • internal/cmd/generate/commands/gentests

1 file changed

+7
-3
lines changed

internal/cmd/generate/commands/gentests/model.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,15 @@ func (ts TestSuite) SkipEsVersion(minmax string) bool {
293293
// BaseFilename returns the original filename in form of `foo/10_bar.yml`.
294294
//
295295
func (t Test) BaseFilename() string {
296+
var index int
296297
parts := strings.Split(t.Filepath, string(filepath.Separator))
297-
if len(parts) < 2 {
298-
return ""
298+
for i, v := range parts {
299+
index = i
300+
if v == "rest-api-spec" {
301+
break
302+
}
299303
}
300-
return strings.Join(parts[len(parts)-2:], string(filepath.Separator))
304+
return strings.Join(parts[index+2:], string(filepath.Separator))
301305
}
302306

303307
// SkipEsVersion returns true if the test should be skipped.

0 commit comments

Comments
 (0)