Skip to content
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

couchbase: wait until all services are part of the config #3003

Merged
merged 2 commits into from Feb 6, 2021

Conversation

daschl
Copy link
Member

@daschl daschl commented Jul 17, 2020

This changeset adds a predicate to the wait strategy to make sure
that it not only returns a 200, but also that every enabled service
is actually already exposed in the config. Since we are polling
the server during bootstrap here, not all of them might show up
at the same time.

Also, while not contributing to the fix we poll the terse bucket
http config "b" instead of the verbose one "buckets" since it is
a little more efficient on the server side and actually the config
the client internally works with.

fixes #2993

}
return true;
} catch (IOException ex) {
logger().error("Unable to parse response {}", rawConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception is swallowed here

@SuppressWarnings("unchecked")
public boolean test(final String rawConfig) {
try {
Map<String, Object> parsedConfig = MAPPER.readValue(rawConfig, new TypeReference<Map<String, Object>>() {});
Copy link
Member

@bsideup bsideup Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using readTree (and its path(String key) to have a null-safe access to sub-objects)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second this, no more casting to Map/List..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll get it patched up shortly

@@ -168,7 +174,7 @@ protected void configure() {
.map("healthy"::equals)
.orElse(false);
} catch (IOException e) {
logger().error("Unable to parse response {}", response);
logger().error("Unable to parse response: " + response, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put back {} for response, Throwables can be the last argument to error() calls.

logger().error("Unable to parse response {}", response, e);

}
return true;
} catch (IOException ex) {
logger().error("Unable to parse response: " + rawConfig, ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use {} placeholder for rawConfig

old habits die hard, eh? ;)

Copy link
Contributor

@aaronjwhiteside aaronjwhiteside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not that I have any sway here, but LGTM

@daschl
Copy link
Member Author

daschl commented Aug 17, 2020

@bsideup @rnorth I think this should be good now, let me know if further modifications are needed :)

@aaronjwhiteside
Copy link
Contributor

@daschl can please have the conflict resolved?

@aaronjwhiteside
Copy link
Contributor

@daschl bump!

This changeset adds a predicate to the wait strategy to make sure
that it not only returns a 200, but also that every enabled service
is actually already exposed in the config. Since we are polling
the server during bootstrap here, not all of them might show up
at the same time.

Also, while not contributing to the fix we poll the terse bucket
http config "b" instead of the verbose one "buckets" since it is
a little more efficient on the server side and actually the config
the client internally works with.

fixes testcontainers#2993
@daschl
Copy link
Member Author

daschl commented Dec 16, 2020

@aaronjwhiteside conflicts resolved and rebased with master.

@aaronjwhiteside
Copy link
Contributor

thanks @daschl, much appreciated!

@bsideup @rnorth does this PR require any further changes?

@aaronjwhiteside
Copy link
Contributor

@bsideup @rnorth Is there any way I can help get this PR reviewed and merged?

@bsideup
Copy link
Member

bsideup commented Feb 6, 2021

@aaronjwhiteside on it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CouchbaseContainer does not actually wait until the query service is available
3 participants