forked from primus-labs/otls
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-test.sh
More file actions
executable file
·78 lines (72 loc) · 2.12 KB
/
docker-test.sh
File metadata and controls
executable file
·78 lines (72 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Make the script executable
chmod +x docker-test.sh
# Function to display help
show_help() {
echo "OTLS Docker Test Helper"
echo "----------------------"
echo "Usage:"
echo " ./docker-test.sh [command]"
echo ""
echo "Commands:"
echo " build Build the Docker image"
echo " run-single Run a single container for local testing"
echo " run-multi Run two containers for two-party testing"
echo " exec-single Execute bash in the single container"
echo " exec-party1 Execute bash in the first party container"
echo " exec-party2 Execute bash in the second party container"
echo " clean Stop and remove all containers"
echo " help Show this help message"
echo ""
echo "Examples:"
echo " ./docker-test.sh build"
echo " ./docker-test.sh run-single"
echo " ./docker-test.sh exec-single"
echo ""
}
# Check if a command is provided
if [ $# -lt 1 ]; then
show_help
exit 1
fi
COMMAND=$1
case $COMMAND in
build)
echo "Building Docker image..."
docker compose build
;;
run-single)
echo "Running single container for local testing..."
docker compose up -d
;;
run-multi)
echo "Running two containers for two-party testing..."
docker compose -f docker-compose.multi.yml up -d
;;
exec-single)
echo "Executing bash in the single container..."
docker compose exec otls bash
;;
exec-party1)
echo "Executing bash in the first party container..."
docker compose -f docker-compose.multi.yml exec otls1 bash
;;
exec-party2)
echo "Executing bash in the second party container..."
docker compose -f docker-compose.multi.yml exec otls2 bash
;;
clean)
echo "Stopping and removing all containers..."
docker compose down
docker compose -f docker-compose.multi.yml down
;;
help)
show_help
;;
*)
echo "Unknown command: $COMMAND"
show_help
exit 1
;;
esac
exit 0