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
fix(tests): Handle early return from influxdb create database #5928
Conversation
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Some times, the influxdb v1 server will return early from creating the database, providing an OK response code before the database is actually created. Subsequent sink calls will then encounter a NOT_FOUND response when trying to write to the database, resulting in a spurious failure. This tests for database existence after creating it by doing an empty write, and looping until that returns NO_CONTENT. Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
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.
Nice! Looks good. I like the approach of looping until it is available.
I do think it'd be good to cap the loop so tests don't hang forever in extreme circumstances. You might just be able to use test_util::wait_for_duration
? https://github.com/timberio/vector/blob/411100307f44d1d73933b0080dca1da254cd914d/src/test_util/mod.rs#L297-L309
src/sinks/influxdb/mod.rs
Outdated
// accept writes to the database, leading to test failures. Test | ||
// this with empty writes and loop if it reports the database | ||
// does not exist yet. | ||
loop { |
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 think it'd be good to have this loop break after, say, 10 iterations (5 seconds) to avoid this test hanging forever.
Signed-off-by: Bruce Guenter <bruce@timber.io>
Sometimes, the influxdb v1 server will return early from creating the
database, providing an OK response code before the database is actually
created. Subsequent sink calls will then encounter a NOT_FOUND response
when trying to write to the database, resulting in a spurious failure.
This tests for database existence after creating it by doing an empty
write, and looping until that returns NO_CONTENT.
Closes #5612
Signed-off-by: Bruce Guenter bruce@timber.io