-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a basic sanity test to run against a remote cluster (#1958)
* Initial commit with a base test, gradle change and execution script Signed-off-by: Darshit Chanpura <[email protected]> * Disable JarHell with classpsloading override Signed-off-by: Peter Nied <[email protected]> * Sample certficates for sanity tests Signed-off-by: Darshit Chanpura <[email protected]> * Updates test and adds a base class that extends OpenSearchRestTestCase and modifies client builder methods Signed-off-by: Darshit Chanpura <[email protected]> * Adds common-utils dependency and modifies integTestRemote task Signed-off-by: Darshit Chanpura <[email protected]> * Updates integtest script Signed-off-by: Darshit Chanpura <[email protected]> * Makes integtest script executable Signed-off-by: Darshit Chanpura <[email protected]> * Updates code hygiene Signed-off-by: Darshit Chanpura <[email protected]> * Disabling integTest task that was auto-triggered Signed-off-by: Darshit Chanpura <[email protected]> * Fix broken github action for build-artifacts Signed-off-by: Darshit Chanpura <[email protected]> * Updates bwc gradle to skip sanity tests Signed-off-by: Darshit Chanpura <[email protected]> * Updates test task to skip sanity test Signed-off-by: Darshit Chanpura <[email protected]> * Code cleanup Signed-off-by: Darshit Chanpura <[email protected]> * Documenting the changes Signed-off-by: Darshit Chanpura <[email protected]> * Updates exclusion filter for build gradle test task Signed-off-by: Darshit Chanpura <[email protected]> * Addresses requested PR changes Signed-off-by: Darshit Chanpura <[email protected]> * Fixes incorrect license headers Signed-off-by: Darshit Chanpura <[email protected]> * Adds sanity tests CI check Signed-off-by: Darshit Chanpura <[email protected]> * Hard codes common-utils version to stop CI from failing Signed-off-by: Darshit Chanpura <[email protected]> * Updates TODO comment with tracking issue Signed-off-by: Darshit Chanpura <[email protected]> * Makes common-utils version dynamic and acceptable as input parameter to gradle command Signed-off-by: Darshit Chanpura <[email protected]> * Update bwc build gradle to exclude sanity tests Signed-off-by: Darshit Chanpura <[email protected]> * Hardcodes default common utils version Signed-off-by: Darshit Chanpura <[email protected]> * Uses assertThat Signed-off-by: Darshit Chanpura <[email protected]> * Removes incorrect license headers Signed-off-by: Darshit Chanpura <[email protected]> * Fixes CI errors Signed-off-by: Darshit Chanpura <[email protected]> Co-authored-by: Peter Nied <[email protected]> (cherry picked from commit f7b6fe5)
- Loading branch information
1 parent
0f6da30
commit 16c4774
Showing
12 changed files
with
422 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function usage() { | ||
echo "" | ||
echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." | ||
echo "--------------------------------------------------------------------------" | ||
echo "Usage: $0 [args]" | ||
echo "" | ||
echo "Required arguments:" | ||
echo "None" | ||
echo "" | ||
echo "Optional arguments:" | ||
echo -e "-b BIND_ADDRESS\t, defaults to localhost | 127.0.0.1, can be changed to any IP or domain name for the cluster location." | ||
echo -e "-p BIND_PORT\t, defaults to 9200, can be changed to any port for the cluster location." | ||
echo -e "-s SECURITY_ENABLED\t(true | false), defaults to true. Specify the OpenSearch/Dashboards have security enabled or not." | ||
echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true." | ||
echo -e "-h\tPrint this message." | ||
echo -e "-v OPENSEARCH_VERSION\t, no defaults" | ||
echo -e "-n SNAPSHOT\t, defaults to false" | ||
echo -e "-m CLUSTER_NAME\t, defaults to docker-cluster" | ||
echo -e "-u COMMON_UTILS_VERSION\t, defaults to 2.2.0.0" | ||
echo "--------------------------------------------------------------------------" | ||
} | ||
|
||
while getopts ":h:b:p:s:c:v:n:t:m:u:" arg; do | ||
case $arg in | ||
h) | ||
usage | ||
exit 1 | ||
;; | ||
b) | ||
BIND_ADDRESS=$OPTARG | ||
;; | ||
p) | ||
BIND_PORT=$OPTARG | ||
;; | ||
t) | ||
TRANSPORT_PORT=$OPTARG | ||
;; | ||
s) | ||
SECURITY_ENABLED=$OPTARG | ||
;; | ||
c) | ||
CREDENTIAL=$OPTARG | ||
;; | ||
m) | ||
CLUSTER_NAME=$OPTARG | ||
;; | ||
v) | ||
# Do nothing as we're not consuming this param. | ||
;; | ||
n) | ||
# Do nothing as we're not consuming this param. | ||
;; | ||
u) | ||
COMMON_UTILS_VERSION=$OPTARG | ||
;; | ||
:) | ||
echo "-${OPTARG} requires an argument" | ||
usage | ||
exit 1 | ||
;; | ||
?) | ||
echo "Invalid option: -${OPTARG}" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
|
||
if [ -z "$BIND_ADDRESS" ] | ||
then | ||
BIND_ADDRESS="localhost" | ||
fi | ||
|
||
if [ -z "$BIND_PORT" ] | ||
then | ||
BIND_PORT="9200" | ||
fi | ||
|
||
if [ -z "$SECURITY_ENABLED" ] | ||
then | ||
SECURITY_ENABLED="true" | ||
fi | ||
|
||
if [ -z "$CREDENTIAL" ] | ||
then | ||
CREDENTIAL="admin:admin" | ||
fi | ||
|
||
if [ -z "$CREDENTIAL" ] | ||
then | ||
CREDENTIAL="admin:admin" | ||
fi | ||
|
||
if [ -z "$CLUSTER_NAME" ] | ||
then | ||
CLUSTER_NAME="docker-cluster" | ||
fi | ||
if [ -z "$COMMON_UTILS_VERSION" ] | ||
then | ||
COMMON_UTILS_VERSION="2.2.0.0" | ||
fi | ||
|
||
USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` | ||
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` | ||
|
||
./gradlew integTestRemote -Dtests.rest.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.cluster="$BIND_ADDRESS:$BIND_PORT" -Dsecurity_enabled=$SECURITY_ENABLED -Dtests.clustername=$CLUSTER_NAME -Dhttps=true -Duser=$USERNAME -Dpassword=$PASSWORD -Dcommon_utils.version=$COMMON_UTILS_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.bootstrap; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* Disable JarHell to unblock test development | ||
* https://github.com/opensearch-project/security/issues/1938 | ||
*/ | ||
public class JarHell { | ||
private JarHell() {} | ||
public static void checkJarHell(Consumer<String> output) throws IOException, Exception {} | ||
public static void checkJarHell(Set<URL> urls, Consumer<String> output) throws URISyntaxException, IOException {} | ||
public static void checkVersionFormat(String targetVersion) {} | ||
public static void checkJavaVersion(String resource, String targetVersion) {} | ||
public static Set<URL> parseClassPath() {return new HashSet<URL>();} | ||
} |
Oops, something went wrong.