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

[Backport 2.x] Update admin credential in integration test #1084

Merged
Merged
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
10 changes: 8 additions & 2 deletions .github/workflows/docker-security-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,18 @@ jobs:
else
echo "imagePresent=false" >> $GITHUB_ENV
fi
- name: Generate Password For Admin
id: genpass
run: |
PASSWORD=$(openssl rand -base64 20 | tr -dc 'A-Za-z0-9!@#$%^&*()_+=-')
echo "password=$PASSWORD" >> $GITHUB_OUTPUT
- 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-index-management:test
container_id=`docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" -e OPENSEARCH_INITIAL_ADMIN_PASSWORD=${{ steps.genpass.outputs.password }} opensearch-index-management:test`
sleep 120
echo `docker logs $container_id`
- name: Run Index Management Test for security enabled test cases
if: env.imagePresent == 'true'
run: |
Expand All @@ -72,7 +78,7 @@ jobs:
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 -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=admin --tests '*SecurityBehaviorIT'
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=docker-cluster -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=${{ steps.genpass.outputs.password }} --tests '*SecurityBehaviorIT'
else
echo "Security plugin is NOT available skipping this run as tests without security have already been run"
fi
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ def waitForClusterSetup(OpenSearchCluster cluster, Boolean securityEnabled) {

Predicate pred = {
String protocol = securityEnabled ? "https" : "http"
WaitForClusterYellow wait = new WaitForClusterYellow(protocol, cluster.getFirstNode().getHttpSocketURI(), cluster.nodes.size())
String host = System.getProperty("tests.cluster", cluster.getFirstNode().getHttpSocketURI())
WaitForClusterYellow wait = new WaitForClusterYellow(protocol, host, cluster.nodes.size())
wait.setUsername(System.getProperty("user", "admin"))
wait.setPassword(System.getProperty("password", "admin"))
return wait.wait(180000)
Expand Down
Loading