-
Notifications
You must be signed in to change notification settings - Fork 141
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
Create custom integ test file for sql plugin. #1330
Create custom integ test file for sql plugin. #1330
Conversation
scripts/integtest.sh
Outdated
USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` | ||
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` | ||
|
||
OPENSEARCH_HOME=`ps -ef | grep "[o]pensearch.path.home" | uniq | tr ' ' '\n' | grep "opensearch.path.home" | grep -Eo "=.*" | sed 's/=//g'` |
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.
no issue. ps -ef | grep -o "[o]pensearch.path.home=\S\+" | cut -d= -f2- | head -n1
is shorter if grep -Po
is not allowed, but it still assumes no spaces in opensearch path. is it a safe assumption?
(if grep has -P option i would probably use something like ps -ef | grep -Po "(?<=[o]pensearch.path.home=).+?(?= -D|$)"
to handle spaces)
Also does this require the script to run against local running cluster only? e.g. no remote clusters, no integTest clusters?
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.
Honestly, I have asked infra team to provide the location of bin. They provided me this. I am not sure if PCRE is available. but let me confirm with them.
scripts/integtest.sh
Outdated
|
||
OPENSEARCH_HOME=`ps -ef | grep "[o]pensearch.path.home" | uniq | tr ' ' '\n' | grep "opensearch.path.home" | grep -Eo "=.*" | sed 's/=//g'` | ||
|
||
curl -SL https://raw.githubusercontent.com/opensearch-project/sql/2.5/integ-test/src/test/resources/datasource/datasources.json -o $OPENSEARCH_HOME/datasources.json |
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.
should this be main or 2.5 (or HEAD
)?
also nit pick to not break if it has spaces
curl -SL https://raw.githubusercontent.com/opensearch-project/sql/2.5/integ-test/src/test/resources/datasource/datasources.json -o $OPENSEARCH_HOME/datasources.json | |
curl -SL https://raw.githubusercontent.com/opensearch-project/sql/2.5/integ-test/src/test/resources/datasource/datasources.json -o "$OPENSEARCH_HOME"/datasources.json |
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.
It can be anything...but main would be better. will make the changes.
scripts/integtest.sh
Outdated
yes | $OPENSEARCH_HOME/bin/opensearch-keystore add-file plugins.query.federation.datasources.config $OPENSEARCH_HOME/datasources.json | ||
|
||
|
||
curl -k --request POST --url https://localhost:9200/_nodes/reload_secure_settings --header 'content-type: application/json' --data '{"secure_settings_password":""}' --user $CREDENTIAL |
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.
use bind address and port instead of localhost:9200?
f818474
to
d565b74
Compare
curl -k --request POST --url https://$BIND_ADDRESS:$BIND_PORT/_nodes/reload_secure_settings --header 'content-type: application/json' --data '{"secure_settings_password":""}' --user $CREDENTIAL | ||
|
||
|
||
./gradlew integTest -Dopensearch.version=$OPENSEARCH_VERSION -Dbuild.snapshot=$SNAPSHOT -Dtests.rest.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.clustername="opensearch-integrationtest" -Dhttps=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD --console=plain |
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.
Add option to pass rest of the command line to gradlew
. It allows you to specify test filter (--tests "..."
) or debug flag -Dtest.debug
and so on.
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 is copied from https://github.com/opensearch-project/opensearch-build/blob/main/scripts/default/integtest.sh. The intent is to customize the script to include datasource creation.
They always default on parameters. we can expand the functionality whenever we need.
Sql Plugin integ tests require add files to keystore to add prometheus datasource. So adding a custom integ script which can be consumed by build repo while triggering integ tests during every release. Signed-off-by: Vamsi Manohar <[email protected]>
d565b74
to
97f45df
Compare
Sql Plugin integ tests require add files to keystore to add prometheus datasource. So adding a custom integ script which can be consumed by build repo while triggering integ tests during every release. Signed-off-by: Vamsi Manohar <[email protected]> (cherry picked from commit 4df8ed7)
Sql Plugin integ tests require add files to keystore to add prometheus datasource. So adding a custom integ script which can be consumed by build repo while triggering integ tests during every release. Signed-off-by: Vamsi Manohar <[email protected]> (cherry picked from commit 4df8ed7)
Sql Plugin integ tests require add files to keystore to add prometheus datasource. So adding a custom integ script which can be consumed by build repo while triggering integ tests during every release. Signed-off-by: Vamsi Manohar <[email protected]> (cherry picked from commit 4df8ed7) Co-authored-by: vamsi-amazon <[email protected]>
Sql Plugin integ tests require add files to keystore to add prometheus datasource. So adding a custom integ script which can be consumed by build repo while triggering integ tests during every release. Signed-off-by: Vamsi Manohar <[email protected]> (cherry picked from commit 4df8ed7) Co-authored-by: vamsi-amazon <[email protected]>
Signed-off-by: Vamsi Manohar [email protected]
Description
Background:
Integ tests during opensearch version release run on a separate local cluster. For sql integ tests to work properly, we need to setup prometheus datasource configuration in keystore. Since this is a customization specific to sql plugin, infra team advised us to maintain a custom script in sql plugin itself. Build system is intelligent enough to decide on which script to run.
Our custom script is a modification of below script.
Reference integtest.sh: https://github.com/opensearch-project/opensearch-build/blob/main/scripts/default/integtest.sh
Issues Resolved
[List any issues this PR will resolve]
Check List
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.