1- name : Multi Tenancy Integration Test
1+ name : Multi Tenancy Integration Test 🚀
22
33on :
44 push :
5- branches :
5+ branches :
66 - multiTenancy_IntegrationTest
7+
78 workflow_dispatch :
89 inputs :
910 cf_space :
@@ -21,119 +22,125 @@ jobs:
2122 runs-on : ubuntu-latest
2223
2324 steps :
24- - name : Checkout repository
25+ - name : Checkout repository ✅
2526 uses : actions/checkout@v2
2627 with :
2728 ref : ${{ github.event.inputs.branch_name }}
2829
29- - name : Set up Java 17
30+ - name : Set up Java 17 ☕
3031 uses : actions/setup-java@v3
3132 with :
3233 java-version : 17
3334 distribution : ' temurin'
3435
35- - name : Install Cloud Foundry CLI and jq
36+ - name : Install Cloud Foundry CLI and jq 📦
3637 run : |
38+ echo "🔧 Installing Cloud Foundry CLI and jq..."
3739 wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
3840 echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
3941 sudo apt-get update
4042 sudo apt-get install cf8-cli jq
41- - name : Determine Cloud Foundry Space
43+
44+ - name : Determine Cloud Foundry Space 🌌
4245 id : determine_space
4346 run : |
4447 if [ "${{ github.event.inputs.cf_space }}" == "developcap" ]; then
4548 space="${{ secrets.CF_SPACE }}"
4649 else
4750 space="${{ github.event.inputs.cf_space }}"
4851 fi
49- echo "Space determined: $space"
52+ echo "🌍 Space determined: $space"
5053 echo "::set-output name=space::$space"
51- - name : Login to Cloud Foundry
54+
55+ - name : Login to Cloud Foundry 🔑
5256 run : |
53- echo "Space Name : ${{ steps.determine_space.outputs.space }}"
57+ echo "🔄 Logging in to Cloud Foundry using space : ${{ steps.determine_space.outputs.space }}"
5458 cf login -a ${{ secrets.CF_API }} \
5559 -u ${{ secrets.CF_USER }} \
5660 -p ${{ secrets.CF_PASSWORD }} \
5761 -o ${{ secrets.CF_ORG }} \
58- -s ${{ secrets.CF_SPACE }}
59- # -s ${{ steps.determine_space.outputs.space }}
60- - name : Fetch and Escape Client Details for single tenant
62+ -s ${{ steps.determine_space.outputs.space }}
63+
64+ - name : Fetch and Escape Client Details for single tenant 🔍
6165 id : fetch_credentials
6266 run : |
63- set -e
67+ echo "Fetching client details for single tenant..."
6468 service_instance_guid=$(cf service demoappjava-public-uaa --guid)
6569 if [ -z "$service_instance_guid" ]; then
66- echo "Error: Unable to retrieve service instance GUID"; exit 1;
70+ echo "❌ Error: Unable to retrieve service instance GUID"; exit 1;
6771 fi
6872
6973 bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}")
7074 binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid')
7175 if [ -z "$binding_guid" ]; then
72- echo "Error: Unable to retrieve binding GUID"; exit 1;
76+ echo "❌ Error: Unable to retrieve binding GUID"; exit 1;
7377 fi
7478
7579 binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details")
7680
7781 clientSecret=$(echo "$binding_details" | jq -r '.credentials.clientsecret')
7882 if [ -z "$clientSecret" ] || [ "$clientSecret" == "null" ]; then
79- echo "Error: clientSecret is not set or is null"; exit 1;
83+ echo "❌ Error: clientSecret is not set or is null"; exit 1;
8084 fi
8185 escapedClientSecret=$(echo "$clientSecret" | sed 's/\$/\\$/g')
8286 echo "::add-mask::$escapedClientSecret"
8387
8488 clientID=$(echo "$binding_details" | jq -r '.credentials.clientid')
8589 if [ -z "$clientID" ] || [ "$clientID" == "null" ]; then
86- echo "Error: clientID is not set or is null"; exit 1;
90+ echo "❌ Error: clientID is not set or is null"; exit 1;
8791 fi
8892 echo "::add-mask::$clientID"
8993
9094 echo "::set-output name=CLIENT_SECRET::$escapedClientSecret"
9195 echo "::set-output name=CLIENT_ID::$clientID"
96+ echo "✅ Client details fetched successfully!"
9297
93- - name : Fetch and Escape Client Details for multi tenant
98+ - name : Fetch and Escape Client Details for multi tenant 🔍
9499 id : fetch_credentials_mt
95100 run : |
96- set -e
101+ echo "Fetching client details for multi tenant..."
97102 service_instance_guid=$(cf service bookshop-mt-uaa --guid)
98103 if [ -z "$service_instance_guid" ]; then
99- echo "Error: Unable to retrieve service instance GUID"; exit 1;
104+ echo "❌ Error: Unable to retrieve service instance GUID"; exit 1;
100105 fi
101106
102107 bindings_response=$(cf curl "/v3/service_credential_bindings?service_instance_guids=${service_instance_guid}")
103108 binding_guid=$(echo "$bindings_response" | jq -r '.resources[0].guid')
104109 if [ -z "$binding_guid" ]; then
105- echo "Error: Unable to retrieve binding GUID"; exit 1;
110+ echo "❌ Error: Unable to retrieve binding GUID"; exit 1;
106111 fi
107112
108113 binding_details=$(cf curl "/v3/service_credential_bindings/${binding_guid}/details")
109114
110115 clientSecret_mt=$(echo "$binding_details" | jq -r '.credentials.clientsecret')
111116 if [ -z "$clientSecret_mt" ] || [ "$clientSecret_mt" == "null" ]; then
112- echo "Error: clientSecret_mt is not set or is null"; exit 1;
117+ echo "❌ Error: clientSecret_mt is not set or is null"; exit 1;
113118 fi
114119 escapedClientSecret_mt=$(echo "$clientSecret_mt" | sed 's/\$/\\$/g')
115120 echo "::add-mask::$escapedClientSecret_mt"
116121
117122 clientID_mt=$(echo "$binding_details" | jq -r '.credentials.clientid')
118123 if [ -z "$clientID_mt" ] || [ "$clientID_mt" == "null" ]; then
119- echo "Error: clientID_mt is not set or is null"; exit 1;
124+ echo "❌ Error: clientID_mt is not set or is null"; exit 1;
120125 fi
121126 echo "::add-mask::$clientID_mt"
122127
123128 echo "::set-output name=CLIENT_SECRET_MT::$escapedClientSecret_mt"
124129 echo "::set-output name=CLIENT_ID_MT::$clientID_mt"
130+ echo "✅ Multi-tenant client details fetched successfully!"
125131
126- - name : Run integration tests
132+ - name : Run integration tests 🎯
127133 env :
128134 CLIENT_SECRET : ${{ steps.fetch_credentials.outputs.CLIENT_SECRET }}
129135 CLIENT_ID : ${{ steps.fetch_credentials.outputs.CLIENT_ID }}
130136 CLIENT_SECRET_MT : ${{ steps.fetch_credentials_mt.outputs.CLIENT_SECRET_MT }}
131137 CLIENT_ID_MT : ${{ steps.fetch_credentials_mt.outputs.CLIENT_ID_MT }}
132138 run : |
139+ echo "🚀 Starting integration tests..."
133140 set -e
134141 PROPERTIES_FILE="sdm/src/test/resources/credentials.properties"
135- appUrl="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com"
136- appUrlMT="${{ secrets.CF_ORG }}-${{ secrets.CF_SPACE }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com"
142+ appUrl="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-demoappjava-srv.cfapps.eu12.hana.ondemand.com"
143+ appUrlMT="${{ secrets.CF_ORG }}-${{ steps.determine_space.outputs.space }}-bookshop-mt-srv.cfapps.eu12.hana.ondemand.com"
137144 authUrl="${{ secrets.CAPAUTH_URL }}"
138145 authUrlMT1="${{ secrets.AUTHURLMT1 }}"
139146 authUrlMT2="${{ secrets.AUTHURLMT2 }}"
@@ -155,19 +162,19 @@ jobs:
155162 echo "::add-mask::$noSDMRoleUsername"
156163 echo "::add-mask::$noSDMRoleUserPassword"
157164
158- if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi
159- if [ -z "$appUrlMT" ]; then echo "Error: appUrlMT is not set"; exit 1; fi
160- if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi
161- if [ -z "$authUrlMT1" ]; then echo "Error: authUrlMT1 is not set"; exit 1; fi
162- if [ -z "$authUrlMT2" ]; then echo "Error: authUrlMT2 is not set"; exit 1; fi
163- if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi
164- if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi
165- if [ -z "$clientIDMT" ]; then echo "Error: clientIDMT is not set"; exit 1; fi
166- if [ -z "$clientSecretMT" ]; then echo "Error: clientSecretMT is not set"; exit 1; fi
167- if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi
168- if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi
169- if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi
170- if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi
165+ if [ -z "$appUrl" ]; then echo "❌ Error: appUrl is not set"; exit 1; fi
166+ if [ -z "$appUrlMT" ]; then echo "❌ Error: appUrlMT is not set"; exit 1; fi
167+ if [ -z "$authUrl" ]; then echo "❌ Error: authUrl is not set"; exit 1; fi
168+ if [ -z "$authUrlMT1" ]; then echo "❌ Error: authUrlMT1 is not set"; exit 1; fi
169+ if [ -z "$authUrlMT2" ]; then echo "❌ Error: authUrlMT2 is not set"; exit 1; fi
170+ if [ -z "$clientID" ]; then echo "❌ Error: clientID is not set"; exit 1; fi
171+ if [ -z "$clientSecret" ]; then echo "❌ Error: clientSecret is not set"; exit 1; fi
172+ if [ -z "$clientIDMT" ]; then echo "❌ Error: clientIDMT is not set"; exit 1; fi
173+ if [ -z "$clientSecretMT" ]; then echo "❌ Error: clientSecretMT is not set"; exit 1; fi
174+ if [ -z "$username" ]; then echo "❌ Error: username is not set"; exit 1; fi
175+ if [ -z "$password" ]; then echo "❌ Error: password is not set"; exit 1; fi
176+ if [ -z "$noSDMRoleUsername" ]; then echo "❌ Error: noSDMRoleUsername is not set"; exit 1; fi
177+ if [ -z "$noSDMRoleUserPassword" ]; then echo "❌ Error: noSDMRoleUserPassword is not set"; exit 1; fi
171178
172179 cat > "$PROPERTIES_FILE" <<EOL
173180 appUrl=$appUrl
@@ -184,9 +191,10 @@ jobs:
184191 noSDMRoleUsername=$noSDMRoleUsername
185192 noSDMRoleUserPassword=$noSDMRoleUserPassword
186193 EOL
187- # Run Maven integration tests
188- echo "Running integration test"
189- # mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests
190- # mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests
191- # mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
192- # mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
194+
195+ echo "🎯 Running Maven integration tests"
196+ mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests
197+ mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT1 -DskipUnitTests
198+ mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
199+ mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=multi -Dtenant=TENANT2 -DskipUnitTests
200+ echo "✅ Integration tests completed!"
0 commit comments