-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·114 lines (99 loc) · 2.9 KB
/
dev.sh
File metadata and controls
executable file
·114 lines (99 loc) · 2.9 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
set -e
cmd="$1" ; shift || true
self_path=$(realpath $0)
self_dir=$(dirname $self_path)
########################################################################################################################
# Up
########################################################################################################################
function cmd_up() {
#
# Bring up development platform
#
$self_dir/deploy/docker-compose/platform.sh up
#
# Unit + Integration Testing
#
echo
echo "Unit Testing"
echo
go test -count 1 ./pkg/... ./internal/...
echo
echo "Integration Testing"
echo
(
export PGCQRS_STORAGE_POSTGRES_URL=integ_tests:integ-tests-password@localhost:16003/integ_db?sslmode=disable
export PGCQRS_INTEG_POSTGRES_URL=postgres:password1234@localhost:16003/postgres?sslmode=disable
go run ./cmd/migrator primary
go test -timeout 10s -count 1 ./pkg/... ./internal/...
)
#
# Launch containers
#
TARGET_OS=linux ./release.sh
$self_dir/deploy/docker-compose/dependencies.sh up
docker-compose --file "$self_dir/docker-compose.yaml" --project-name pgcqrs up --remove-orphans --build --detach
#
# System Tests
#
run_system_tests
#
# Reattach logs
#
docker-compose --file "$self_dir/docker-compose.yaml" --project-name pgcqrs logs --follow
}
########################################################################################################################
# System Tests
########################################################################################################################
function cmd_system_tests() {
run_system_tests
}
function run_system_tests() {
(cd $self_dir
#
# Example drift detection - verifies examples work with current codebase
#
echo
echo "Running examples to detect API drift"
echo
export PGCQRS_SERVICE_URL_HTTP=http://localhost:26000
export PGCQRS_SERVICE_URL_GRPC=localhost:26001
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:16001"
export OTEL_EXPORTER=grpc
./run-examples.sh
#
# Transport verification - runs systest with memory, HTTP, gRPC
#
echo
echo "Running integration tests across all transports"
echo
./integration-tests.sh docked
)
}
########################################################################################################################
# Command Processing
########################################################################################################################
function cmd_unknown_help() {
echo "$cmd is an unknown subcommand"
summary_help
}
function summary_help() {
echo "$0 <sub-command>"
echo "Where <sub-command> is one of:"
echo " up - containerize then runs the project"
echo " system_tests - runs just the system tests (assumes containers are running)"
}
case "$cmd" in
"")
summary_help
;;
up)
cmd_up
;;
system_tests)
cmd_system_tests
;;
*)
cmd_unknown_help
;;
esac