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

Add mechanism to run benchmark tests against a given cluster endpoint #4541

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

Divyaasm
Copy link
Collaborator

@Divyaasm Divyaasm commented Mar 18, 2024

Description

  1. Runs benchmark tests against any given opensearch cluster
  2. Refactor new password changes for versions >= 2.12.0
  3. Use semver.Version instead of semver.compare in utils.py to avoid warnings as semver.compare is depreciated

Issues Resolved

Adresses #4478
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 94.21488% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 92.39%. Comparing base (cf8508d) to head (860541e).
Report is 29 commits behind head on main.

Files Patch % Lines
...orkflow/benchmark_test/benchmark_create_cluster.py 91.02% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4541      +/-   ##
==========================================
+ Coverage   92.17%   92.39%   +0.22%     
==========================================
  Files         192      193       +1     
  Lines        6297     6314      +17     
==========================================
+ Hits         5804     5834      +30     
+ Misses        493      480      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Divyaasm Divyaasm changed the title Add mechanism run benchmark tests against a given cluster endpoint Add mechanism to run benchmark tests against a given cluster endpoint Mar 18, 2024
load_balancer_url = cdk_output[self.stack_name].get('loadbalancerurl', None)
if load_balancer_url is None:
raise RuntimeError("Unable to fetch the cluster endpoint from cdk output")
self.args.cluster_endpoint = load_balancer_url
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we overwriting the args.cluster_endpoint?
Need better way to handle this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assuming cluster_endpoint is provided in self.args.cluster_endpoint, In cases where manifest and distribution _url are provided this is empty. I will remove the above line.
self.cluster_endpoint_with_port should do the work for us

Copy link
Collaborator

Choose a reason for hiding this comment

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

override the self.cluster_endpoint class var here as mentioned in other comments.

)
self.params = "".join(params_list) + role_params
self.is_endpoint_public = False
self.cluster_endpoint = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

declare self.cluster_endpoint = args.cluster_endpoint and then override this class var in BenchmarkCreateCluster class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure Rishabh


@property
def endpoint(self) -> str:
return self.cluster_endpoint
return self.args.cluster_endpoint
Copy link
Collaborator

Choose a reason for hiding this comment

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

return self.cluster_endpoint as per above comment.

raise RuntimeError("Unable to fetch the cluster endpoint from cdk output")
self.cluster_endpoint = loadbalancer_url
self.cluster_endpoint_with_port = "".join([loadbalancer_url, ":", str(self.port)])
self.cluster_endpoint_with_port = "".join([self.args.cluster_endpoint, ":", str(self.port)])
Copy link
Collaborator

Choose a reason for hiding this comment

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

This may cause an issue. We will have to explicitly state that the endpoint should be passed without http or https.
Verify if benchmark command accepts --target-url in the form of https://<endpoint>:443. If yes then ignore else we need to clarify it.


def start(self) -> None:
command = f"npm install && cdk deploy \"*\" {self.params} --outputs-file {self.output_file}"
command = f"curl -X GET http://{self.args.cluster_endpoint}" if self.args.insecure else f"curl -X GET https://{self.args.cluster_endpoint} -u 'admin:{get_password('2.12.0')}' --insecure"
Copy link
Collaborator

Choose a reason for hiding this comment

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

use the form https://<endpoint> -ku user:pass, remove --insecure flag.

Signed-off-by: Divya Madala <[email protected]>
@rishabh6788
Copy link
Collaborator

LGTM! Thank you for contributing this change.
Ignoring linkchecker issues and merging.

@rishabh6788 rishabh6788 merged commit f844de7 into opensearch-project:main Mar 28, 2024
11 of 12 checks passed
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.

2 participants