-
Notifications
You must be signed in to change notification settings - Fork 127
Do not create kibana client for pipeline and static tests #1567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not create kibana client for pipeline and static tests #1567
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| } | ||
| } | ||
|
|
||
| var results []testrunner.TestResult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should early check in the runners that need a kibana client if it is not nil, to avoid panics, but I guess we will find these panics during tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked for the other test commands, and these are the example of outputs (static does not require neither the kibana client).
$ elastic-package test asset -v
2023/11/27 17:22:15 DEBUG Enable verbose logging
2023/11/27 17:22:15 DEBUG Distribution built without a version tag, can't determine release chronology. Please consider using official releases at https://github.com/elastic/elastic-package/releases
Run asset tests for the package
2023/11/27 17:22:15 DEBUG installing package...
Error: error running package asset tests: could not complete test run: can't create the package installer: missing kibana client
$ elastic-package test system -v
2023/11/27 17:23:36 DEBUG Enable verbose logging
2023/11/27 17:23:36 DEBUG Distribution built without a version tag, can't determine release chronology. Please consider using official releases at https://github.com/elastic/elastic-package/releases
Run system tests for the package
2023/11/27 17:23:36 DEBUG Running system tests for data stream
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x2ee7d0c]
goroutine 1 [running]:
github.com/elastic/elastic-package/internal/kibana.(*Client).Version(...)
/home/mariorodriguez/Coding/work/elastic-package/internal/kibana/status.go:42
github.com/elastic/elastic-package/internal/testrunner/runners/system.(*runner).run(0xc0001bb740)
/home/mariorodriguez/Coding/work/elastic-package/internal/testrunner/runners/system/runner.go:213 +0x32c
github.com/elastic/elastic-package/internal/testrunner/runners/system.(*runner).Run(0x39bdfc0?, {0xc000542720, {{0xc000374980, 0x74}, {0xc00005809b, 0x18}, {0xc0003749dc, 0x7}}, {0xc000058064, 0x4f}, ...})
/home/mariorodriguez/Coding/work/elastic-package/internal/testrunner/runners/system/runner.go:135 +0x5d
github.com/elastic/elastic-package/internal/testrunner.Run({0x35c0750, 0x6}, {0xc000542720, {{0xc000374980, 0x74}, {0xc00005809b, 0x18}, {0xc0003749dc, 0x7}}, {0xc000058064, ...}, ...})
/home/mariorodriguez/Coding/work/elastic-package/internal/testrunner/testrunner.go:271 +0x95
github.com/elastic/elastic-package/cmd.testTypeCommandActionFactory.func1(0xc000625200, {0xc0002be530?, 0x0?, 0x1?})
/home/mariorodriguez/Coding/work/elastic-package/cmd/testrunner.go:239 +0xff8
github.com/spf13/cobra.(*Command).execute(0xc000625200, {0xc0002be510, 0x1, 0x1})
/home/mariorodriguez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0xc000636000)
/home/mariorodriguez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x12cfc1a?)
/home/mariorodriguez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
/home/mariorodriguez/Coding/work/elastic-package/main.go:23 +0x65
$ elastic-package test static -v
2023/11/27 17:23:24 DEBUG Enable verbose logging
2023/11/27 17:23:24 DEBUG Distribution built without a version tag, can't determine release chronology. Please consider using official releases at https://github.com/elastic/elastic-package/releases
Run static tests for the package
--- Test results for package: elastic_package_registry - START ---
╭──────────────────────────┬─────────────┬───────────┬──────────────────────────┬────────┬──────────────╮
│ PACKAGE │ DATA STREAM │ TEST TYPE │ TEST NAME │ RESULT │ TIME ELAPSED │
├──────────────────────────┼─────────────┼───────────┼──────────────────────────┼────────┼──────────────┤
│ elastic_package_registry │ metrics │ static │ Verify sample_event.json │ PASS │ 36.873029ms │
╰──────────────────────────┴─────────────┴───────────┴──────────────────────────┴────────┴──────────────╯
--- Test results for package: elastic_package_registry - END ---
Done
As for static is not required neither a kibana client, I will also remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to each runner a check at the beginning of the execution to ensure that the required clients are created. That would avoid also panic errors too.
💚 Build Succeeded
History
cc @mrodm |
This PR avoids creating the kibana client for the pipeline and static tests.
These pipeline tests just need the Simulate API from elasticsearch, so it is not required there to have a Kibana client. And the static tests are verifying the sample events.
Related docs about pipeline and static tests: