Skip to content

Commit

Permalink
Re-enable Tests for CI workflows (#509)
Browse files Browse the repository at this point in the history
* Re enable tests for CI

Signed-off-by: aksingh-es <[email protected]>

* reenable CI tests

Signed-off-by: aksingh-es <[email protected]>

* fixing minor issue

Signed-off-by: aksingh-es <[email protected]>

* fixing minor issue for CI

Signed-off-by: aksingh-es <[email protected]>
  • Loading branch information
aksingh-es authored Apr 21, 2022
1 parent d874960 commit a44ffec
Showing 1 changed file with 44 additions and 45 deletions.
89 changes: 44 additions & 45 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,51 +48,50 @@ jobs:
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
# ToDo: Check infra team for 2.0 docker availability and re-enable
# - name: Pull and Run Docker
# run: |
# plugin=`basename $(ls plugin/build/distributions/*.zip)`
# version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3`
# plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4`
# qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1`
# candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1`
# docker_version=$version-$qualifier
#
# [[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier=""
#
# echo plugin version plugin_version qualifier candidate_version docker_version
# echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)"
#
# cd ..
# if docker pull opensearchstaging/opensearch:$docker_version
# then
# echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile
# echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-anomaly-detection ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-anomaly-detection; fi" >> Dockerfile
# echo "ADD anomaly-detection/build/distributions/$plugin /tmp/" >> Dockerfile
# echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile
# docker build -t opensearch-ad:test .
# echo "imagePresent=true" >> $GITHUB_ENV
# else
# echo "imagePresent=false" >> $GITHUB_ENV
# fi
# - name: Run Docker Image
# if: env.imagePresent == 'true'
# run: |
# cd ..
# docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-ad:test
# sleep 90
# - name: Run AD Test
# if: env.imagePresent == 'true'
# run: |
# security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opensearch-security|wc -l`
# if [ $security -gt 0 ]
# then
# echo "Security plugin is available"
# ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin
# else
# echo "Security plugin is NOT available"
# ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster"
# fi
- name: Pull and Run Docker
run: |
plugin=`basename $(ls build/distributions/*.zip)`
version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3`
plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4`
qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1`
candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1`
docker_version=$version-$qualifier
[[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier=""
echo plugin version plugin_version qualifier candidate_version docker_version
echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)"
cd ..
if docker pull opensearchstaging/opensearch:$docker_version
then
echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile
echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-anomaly-detection ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-anomaly-detection; fi" >> Dockerfile
echo "ADD anomaly-detection/build/distributions/$plugin /tmp/" >> Dockerfile
echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile
docker build -t opensearch-ad:test .
echo "imagePresent=true" >> $GITHUB_ENV
else
echo "imagePresent=false" >> $GITHUB_ENV
fi
- name: Run Docker Image
if: env.imagePresent == 'true'
run: |
cd ..
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-ad:test
sleep 90
- name: Run AD Test
if: env.imagePresent == 'true'
run: |
security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opensearch-security|wc -l`
if [ $security -gt 0 ]
then
echo "Security plugin is available"
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin
else
echo "Security plugin is NOT available"
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster"
fi
- name: Run AD Backwards Compatibility Tests
run: |
echo "Running backwards compatibility tests ..."
Expand Down

0 comments on commit a44ffec

Please sign in to comment.