Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add integration test for the /override API #195

Merged
merged 3 commits into from
Sep 28, 2020
Merged

Conversation

ktkrg
Copy link
Contributor

@ktkrg ktkrg commented Sep 2, 2020

Fixes #, if available:
#196
Description of changes:
Adds integration test for the override api

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ktkrg ktkrg self-assigned this Sep 2, 2020
@ktkrg ktkrg added the enhancement New feature or request label Sep 2, 2020
yojs
yojs previously approved these changes Sep 4, 2020
Comment on lines +22 to +27
Request request = new Request("GET",
"/_opendistro/_performanceanalyzer/metrics/?metrics=Disk_Utilization&agg=max&dim=&nodes=all");
Response resp = paClient.performRequest(request);
Assert.assertEquals(HttpStatus.SC_OK, resp.getStatusLine().getStatusCode());
jsonString[0] = EntityUtils.toString(resp.getEntity());
JsonNode root = mapper.readTree(jsonString[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be very frequently used. Therefore, do you think we should create a helper method in PerformanceAnalyzerIntegTestBase that takes URI and request PARAMS and then converts the response to Json and returns ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this would be very useful and it's much better than ad hoc JSON parsing, but I think that can be a near future iteration and doesn't have to be a part of this PR

Comment on lines +22 to +27
Request request = new Request("GET",
"/_opendistro/_performanceanalyzer/metrics/?metrics=Disk_Utilization&agg=max&dim=&nodes=all");
Response resp = paClient.performRequest(request);
Assert.assertEquals(HttpStatus.SC_OK, resp.getStatusLine().getStatusCode());
jsonString[0] = EntityUtils.toString(resp.getEntity());
JsonNode root = mapper.readTree(jsonString[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this would be very useful and it's much better than ad hoc JSON parsing, but I think that can be a near future iteration and doesn't have to be a part of this PR

Comment on lines +51 to +63
@Test
public void testRcaIsRunning() throws Exception {
ensurePaAndRcaEnabled();
WaitFor.waitFor(() -> {
Request request = new Request("GET", "/_opendistro/_performanceanalyzer/rca");
try {
Response resp = paClient.performRequest(request);
return Objects.equals(HttpStatus.SC_OK, resp.getStatusLine().getStatusCode());
} catch (Exception e) { // 404, RCA context hasn't been set up yet
return false;
}
}, 2, TimeUnit.MINUTES);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make this a utility method in the base class? It doesn't have to be a test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel it's a good test!

@ktkrg ktkrg merged commit dff2562 into master Sep 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants