-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add helper to get hosts on Go Metricbeat integration tests #13055
Add helper to get hosts on Go Metricbeat integration tests #13055
Conversation
04489a8
to
2d8cdaf
Compare
5522efd
to
a3ce2e2
Compare
jenkins, test this again please |
1 similar comment
jenkins, test this again please |
f12a31b
to
8284004
Compare
jenkins, test this again please |
82ee7f4
to
e8941df
Compare
1982ad0
to
b523145
Compare
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.
This is a great enabler! did a first pass and left some questions, I will look into it more tomorrow
} | ||
|
||
// EnsureUpWithTimeout starts all the requested services (must be defined in docker-compose.yml) | ||
// Wait for `timeout` seconds for health | ||
func EnsureUpWithTimeout(t *testing.T, timeout int, services ...string) { |
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.
what’s the reason to accept only one service? not saying it’s a bad idea, just want to know the reasoning
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.
There are two main reasons:
- It simplifies the returned information. With an only service, only an object with the host information for a service is returned.
- It doesn't seem to be needed, we only had an scenario with two services (Kibana, that also needs Elasticsearch), and it can also be done with docker compose dependencies. If access to both hosts were needed, we could have two
EnsureUp
.
If wouldn't be hard to implement it though, by returning a struct with all the services info and adding a method like HostForServicePort(service, port) HostInfo
. But I didn't consider it neccessary by now.
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.
That sounds good to me, thanks for the explanation!
metricbeat/module/aerospike/namespace/namespace_integration_test.go
Outdated
Show resolved
Hide resolved
I'm happy if CI is happy |
jenkins, test this again please |
} | ||
|
||
// Wait ensures all wanted services are healthy. Wait loop (60s timeout) | ||
func (c *Project) Wait(seconds int, services ...string) error { | ||
func (c *Project) Wait(seconds time.Duration, services ...string) error { |
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.
👍
CI is happy, we all are happy 🙂 |
Takes from #13039 and #7957 the required changes to allow
Metricbeat integration tests to obtain the hosts of the containers
from the framework, instead of needing to use environment
variables and tricky setups. This allows to run integration tests
for specific modules with
go run -tags=integration
, withoutprevious setup.
This is similar to the change introduced for python tests in #11925.
<SERVICE>_HOST
environment variable can be set to thehost:port of a running service to avoid using compose, similarly
to old
NO_COMPOSE
environment variable.This PR modifies many files, but most of the relevant changes
are in libbeat, and in the metricbeat docker compose. In the docker
compose file,
env
files are removed and metricbeat is run in the hostnetwork. The rest of changes are to adapt the integration tests to
don't depend on environment variables to get the hosts information.