diff --git a/e2e-tests/discovery/run-test.sh b/e2e-tests/discovery/run-test.sh index dd88659cf..5c4cd38d2 100755 --- a/e2e-tests/discovery/run-test.sh +++ b/e2e-tests/discovery/run-test.sh @@ -48,7 +48,13 @@ fi echo "---------------------------------------" echo "Registering care organization on Discovery Service..." echo "---------------------------------------" -curl --insecure -s -X POST http://localhost:28081/internal/discovery/v1/dev:eOverdracht2023/${SUBJECT} +RESPONSE=$(curl --insecure -s -X POST http://localhost:28081/internal/discovery/v1/dev:eOverdracht2023/${SUBJECT}) +if [ -z "${RESPONSE}" ]; then + echo "Registered for service" +else + echo "FAILED: Could not register for Discovery Service" 1>&2 + exitWithDockerLogs 1 +fi # Registration refresh interval is 500ms, wait some to make sure the registration is refreshed sleep 2 @@ -68,8 +74,6 @@ fi echo "---------------------------------------" echo "Searching for care organization registration on Discovery Client..." echo "---------------------------------------" -# Service refresh interval is 500ms, wait some to make sure the presentations are loaded -sleep 2 RESPONSE=$(curl -s --insecure "http://localhost:28081/internal/discovery/v1/dev:eOverdracht2023?credentialSubject.organization.name=Care*") NUM_ITEMS=$(echo $RESPONSE | jq length) if [ $NUM_ITEMS -eq 1 ]; then @@ -87,6 +91,44 @@ else exitWithDockerLogs 1 fi +echo "---------------------------------------" +echo "Retract Discovery Service registration..." +echo "---------------------------------------" +RESPONSE=$(curl --insecure -s -X DELETE http://localhost:28081/internal/discovery/v1/dev:eOverdracht2023/${SUBJECT}) +if [ -z "${RESPONSE}" ]; then + echo "Registration revoked" +else + echo "FAILED: Registration not (immediately) revoked" 1>&2 + exitWithDockerLogs 1 +fi + +# Registration refresh interval is 500ms, wait some to make sure the registration is refreshed +sleep 2 + +echo "---------------------------------------" +echo "Searching for care organization registration on Discovery Server..." +echo "---------------------------------------" +RESPONSE=$(curl -s --insecure "http://localhost:18081/internal/discovery/v1/dev:eOverdracht2023?credentialSubject.organization.name=Care*") +NUM_ITEMS=$(echo $RESPONSE | jq length) +if [ $NUM_ITEMS -eq 0 ]; then + echo "Registration not found" +else + echo "FAILED: Found registration" 1>&2 + exitWithDockerLogs 1 +fi + +echo "---------------------------------------" +echo "Searching for care organization registration on Discovery Client..." +echo "---------------------------------------" +RESPONSE=$(curl -s --insecure "http://localhost:28081/internal/discovery/v1/dev:eOverdracht2023?credentialSubject.organization.name=Care*") +NUM_ITEMS=$(echo $RESPONSE | jq length) +if [ $NUM_ITEMS -eq 0 ]; then + echo "Registration not found" +else + echo "FAILED: Found registration" 1>&2 + exitWithDockerLogs 1 +fi + echo "------------------------------------" echo "Stopping Docker containers..." echo "------------------------------------"