-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b7b51f
commit c9a225f
Showing
4 changed files
with
107 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
tasks: | ||
make-all: | ||
name: Make All | ||
command: | | ||
make all | ||
triggeredBy: | ||
- manual | ||
- postEnvironmentStart | ||
# - postDevcontainerStart | ||
|
||
services: | ||
start-opcplc-server: | ||
name: start-opcplc-server | ||
description: Start opcplc docker containers for testing | ||
commands: | ||
start: | | ||
cd tests && docker-compose -f docker-compose.yaml up | ||
ready: | | ||
cd tests | ||
# Define the list of services to check | ||
services=("opcplc") | ||
max_retries=30 | ||
delay=2 | ||
for service in "${services[@]}"; do | ||
echo "Checking status of service: $service" | ||
for ((i=1;i<=max_retries;i++)); do | ||
# Get the container ID for the service | ||
container_id=$(docker-compose -f docker-compose.yaml -f docker-compose-modbus.yaml ps -q $service) | ||
if [ -z "$container_id" ]; then | ||
echo "Service $service not found. Retrying in $delay seconds..." | ||
else | ||
# Check if the container is running | ||
status=$(docker inspect -f '{{.State.Running}}' $container_id 2>/dev/null) | ||
if [ "$status" == "true" ]; then | ||
echo "Service $service is running." | ||
break | ||
else | ||
echo "Service $service is not running yet. Attempt $i/$max_retries." | ||
fi | ||
fi | ||
if [ $i -eq $max_retries ]; then | ||
echo "Service $service failed to start within the expected time." | ||
exit 1 | ||
fi | ||
sleep $delay | ||
done | ||
done | ||
echo "All services are up and running." | ||
exit 0 | ||
stop: | | ||
echo "Stopping Docker Compose testing services..." | ||
cd tests && docker-compose -f docker-compose.yaml down | ||
triggeredBy: | ||
- postEnvironmentStart | ||
# - postDevcontainerStart | ||
|
||
start-modbus-server: | ||
name: start-modbus-server | ||
description: Start modbus docker containers for testing | ||
commands: | ||
start: | | ||
cd tests && docker-compose -f docker-compose-modbus.yaml up | ||
ready: | | ||
cd tests | ||
# Define the list of services to check | ||
services=("modbus-server") | ||
max_retries=30 | ||
delay=2 | ||
for service in "${services[@]}"; do | ||
echo "Checking status of service: $service" | ||
for ((i=1;i<=max_retries;i++)); do | ||
# Get the container ID for the service | ||
container_id=$(docker-compose -f docker-compose.yaml -f docker-compose-modbus.yaml ps -q $service) | ||
if [ -z "$container_id" ]; then | ||
echo "Service $service not found. Retrying in $delay seconds..." | ||
else | ||
# Check if the container is running | ||
status=$(docker inspect -f '{{.State.Running}}' $container_id 2>/dev/null) | ||
if [ "$status" == "true" ]; then | ||
echo "Service $service is running." | ||
break | ||
else | ||
echo "Service $service is not running yet. Attempt $i/$max_retries." | ||
fi | ||
fi | ||
if [ $i -eq $max_retries ]; then | ||
echo "Service $service failed to start within the expected time." | ||
exit 1 | ||
fi | ||
sleep $delay | ||
done | ||
done | ||
echo "All services are up and running." | ||
exit 0 | ||
stop: | | ||
echo "Stopping Docker Compose testing services..." | ||
cd tests && docker-compose -f docker-compose-modbus.yaml down | ||
triggeredBy: | ||
- postEnvironmentStart | ||
# - postDevcontainerStart |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: "3.8" | ||
services: | ||
opcplc: | ||
image: mcr.microsoft.com/iotedge/opc-plc:2.9.11 | ||
|