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 env_var params to allow customizing runs on ftrepo tests #1428

Draft
wants to merge 9 commits into
base: 2.15
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions integtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function usage() {
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 or 5601 depends on OpenSearch or Dashboards, 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 "-e ENV_VAR\t, no defaults, specify potential ENV_VAR in integtest.sh, separate by comma(,) if adding multiple (-e \"CYPRESS_NO_COMMAND_LOG=1,SOME_PARAMS=2\")"
echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true."
echo -e "-t TEST_COMPONENTS\t(OpenSearch-Dashboards reportsDashboards etc.), optional, specify test components, separate with space, else test everything."
echo -e "-v VERSION\t, no defaults, indicates the OpenSearch version to test."
Expand All @@ -26,7 +27,7 @@ function usage() {
echo "--------------------------------------------------------------------------"
}

while getopts ":hb:p:s:c:t:v:o:r:" arg; do
while getopts ":hb:p:s:e:c:t:v:o:r:" arg; do
case $arg in
h)
usage
Expand All @@ -41,6 +42,9 @@ while getopts ":hb:p:s:c:t:v:o:r:" arg; do
s)
SECURITY_ENABLED=$OPTARG
;;
e)
ENV_VAR=$OPTARG
;;
c)
CREDENTIAL=$OPTARG
;;
Expand Down Expand Up @@ -84,6 +88,11 @@ then
SECURITY_ENABLED="true"
fi

if [ -n "$ENV_VAR" ]; then
echo "User defined ENV_VAR for the run: $ENV_VAR"
ENV_VAR=,$ENV_VAR
fi

if [ -z "$REMOTE_CYPRESS_ENABLED" ]
then
REMOTE_CYPRESS_ENABLED="true"
Expand Down Expand Up @@ -130,9 +139,11 @@ fi

if [ "$SECURITY_ENABLED" = "true" ]
then
echo "run security enabled tests"
yarn cypress:run-with-security --browser "$BROWSER_PATH" --spec "$TEST_FILES"
cmd="yarn cypress:run --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=3000$ENV_VAR --browser \"$BROWSER_PATH\" --spec \"$TEST_FILES\""
echo "run security enabled tests: $cmd"
eval $cmd
else
echo "run security disabled tests"
yarn cypress:run-without-security --browser "$BROWSER_PATH" --spec "$TEST_FILES"
cmd="$ENV_VAR yarn cypress:run --env SECURITY_ENABLED=false$ENV_VAR --browser \"$BROWSER_PATH\" --spec \"$TEST_FILES\""
echo "run security disabled tests: $cmd"
eval $cmd
fi
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cypress:open": "cypress open",
"cypress:run": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless",
"cypress:run-without-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=false",
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=3000",
"cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=3000",
Expand Down
Loading