-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[cloud-gce] Move integration tests to unit tests #12786
Conversation
@Override | ||
public List<Instance> apply(String zoneId) { | ||
try { | ||
Compute.Instances.List list = client().instances().list(project, zoneId); | ||
InstanceList instanceList = list.execute(); | ||
if (instanceList.isEmpty()) { | ||
return new ArrayList(); | ||
return Lists.newArrayList(); |
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 just saw @s1monw replacing Lists.newArrayList
with new ArrayList<>()
a few days ago. Maybe that way is out preferred way now?
+1 on removing the warning though.
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.
yeah please just return Collections.EMPTY_LIST here or so?
Tests are failing with:
Not sure what I should look at from this? Any idea @rjernst @rmuir ? |
.setApplicationName(Fields.VERSION) | ||
.setHttpRequestInitializer(credential) | ||
.build(); | ||
} catch (Exception e) { | ||
logger.warn("unable to start GCE discovery service: {} : {}", e.getClass().getName(), e.getMessage()); | ||
logger.warn("unable to start GCE discovery service: {} : {}", e, e.getClass().getName(), e.getMessage()); |
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 looks not quite right. I'm not 100% sure, but I'd do:
+ logger.warn("unable to start GCE discovery service", e);
and let the logger do its job with the exception. I'm tired though - airplanes. So don't take what I type at face value.
Thanks to @rmuir comment, I found my issue (and learned from that BTW) and fixed it. It's now running fine. Also fixed comments left in the first review. Let me know! I consider this PR as a first try on GCE. I'd like to do next the same cleanup on azure and aws if possible. |
I marked it as a blocker as we have a |
super(settings); | ||
this.project = settings.get(Fields.PROJECT); | ||
String[] zoneList = settings.getAsArray(Fields.ZONE); | ||
this.zoneList = Lists.newArrayList(zoneList); | ||
this.zones = Lists.newArrayList(zoneList); |
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.
please use Arrays.asList while we re here
left some comments - this looks awesome |
@s1monw Updated with your comments. |
left one comment LGTM otherwise |
f35145d
to
7fa674e
Compare
We use google transport mock as we can simulate whatever JSON answer GCE platform will send us and really test Gce implementation. We also remove GceSimpleITest as the goal of this class was only to check that when we start elasticsearch with this plugin, elasticsearch works fine. We don't need that anymore as we now have RestIT which do that right (and better)! Closes elastic#12622
Basically this PR:
Would love to get feedback from reviewers. Thanks!