Skip to content

Commit

Permalink
fixup!test: rework to share principles with redis sample - fix
Browse files Browse the repository at this point in the history
  • Loading branch information
o-orand committed Oct 2, 2024
1 parent fdafd0d commit b362ba3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions local.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
echo "Sourcing local env properties"
export CNB_IMAGE_NAME=mongodb-cnb-app
export SERVICE_NAME=mongodb
export SERVICE_HEALTH_CMD=mongo
Expand All @@ -6,4 +7,6 @@ export DATABASE_NAME=myCollection
export SERVICE_IMAGE="mongo:7.0.14"
export SERVICE_HOST="dynamically_generated"
export SERVICE_PASSWORD=my-passwwwwwwwword15;
export SERVICE_USERNAME='22032e25-4aba-417f-a394-8bbd78d920cd'
export SERVICE_PASSWORD='StbQ4EovUpwQjD0cT1Hr7PKBG'
#export DEBUG=0
4 changes: 2 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ function check_service() {
export APP="http://127.0.0.1:8080"
set +e
exit_status=0
create_service_output="$(check_service "Create" "curl -sSLf -X POST $APP/myCollection -H 'Content-Length: 0' )"
create_service_output="$(check_service "Create" "curl -sSLf -X POST $APP/myCollection -d bar")"
create_service=$?

#get_service_output="$(check_service "Get" "curl -sSLf -X GET $APP/foo" )"
#get_service=$?

delete_service_output="$(check_service "Delete" "curl -sSLf DELETE $APP/myCollection" )"
delete_service_output="$(check_service "Delete" "curl -sSLf DELETE $APP/myCollection")"
delete_service=$?
set -e

Expand Down
5 changes: 3 additions & 2 deletions setup-prerequisite.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -e
echo "Processing $0"

service_container_id=$(docker run -d -p $SERVICE_PORT:$SERVICE_PORT \
service_container_id=$(docker run -d --rm -p $SERVICE_PORT:$SERVICE_PORT \
-e MONGO_INITDB_ROOT_USERNAME="$SERVICE_USERNAME" \
-e MONGO_INITDB_ROOT_PASSWORD="$SERVICE_PASSWORD" \
-e MONGO_INITDB_DATABASE="$DATABASE_NAME" \
Expand All @@ -13,5 +14,5 @@ service_container_name="$(docker ps -f "ancestor=$SERVICE_IMAGE" --format "{{.Na
SERVICE_CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$service_container_name")
echo "$SERVICE_CONTAINER_IP: $SERVICE_CONTAINER_IP"
export SERVICE_HOST=$SERVICE_CONTAINER_IP
docker exec -i "$service_container_name" 'if mongosh --version;then echo "mongosh available";else echo "mongosh UNAVAILABLE";fi'
echo "Mongosh version: $(docker exec -i $service_container_name mongosh --version)"
echo "SERVICE_HOST: $SERVICE_HOST"
3 changes: 3 additions & 0 deletions start-cnd-app-locally.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env bash
set -e

echo "Cleanup existing services"
for c in cnb-app-container mongodb-service;do
echo "Stopping $c"
if docker container stop $c;then
echo "Removing $c"
docker container rm -f $c
fi
done
Expand Down

0 comments on commit b362ba3

Please sign in to comment.