142 lines
1.8 KiB
Bash
Executable File
142 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
if ! set -o pipefail 2>/dev/null; then
|
|
:
|
|
fi
|
|
|
|
SERVICE="${1:-}"
|
|
if [ -z "${SERVICE}" ]; then
|
|
echo "usage: $0 <service-key>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
|
|
cd "${REPO_ROOT}"
|
|
|
|
run_go_tests() {
|
|
module="$1"
|
|
if [ ! -f "${module}/go.mod" ]; then
|
|
echo "[backend-tests] missing go.mod for module: ${module}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "[backend-tests] running go test ./... in ${module}"
|
|
(
|
|
cd "${module}"
|
|
go test ./...
|
|
)
|
|
}
|
|
|
|
case "${SERVICE}" in
|
|
bff)
|
|
modules="
|
|
api/pkg
|
|
api/edge/bff
|
|
"
|
|
;;
|
|
callbacks)
|
|
modules="
|
|
api/pkg
|
|
api/edge/callbacks
|
|
"
|
|
;;
|
|
billing_documents)
|
|
modules="
|
|
api/pkg
|
|
api/billing/documents
|
|
"
|
|
;;
|
|
billing_fees)
|
|
modules="
|
|
api/pkg
|
|
api/billing/fees
|
|
"
|
|
;;
|
|
discovery)
|
|
modules="
|
|
api/pkg
|
|
api/discovery
|
|
"
|
|
;;
|
|
fx_ingestor)
|
|
modules="
|
|
api/pkg
|
|
api/fx/storage
|
|
api/fx/ingestor
|
|
"
|
|
;;
|
|
fx_oracle)
|
|
modules="
|
|
api/pkg
|
|
api/fx/storage
|
|
api/fx/oracle
|
|
"
|
|
;;
|
|
gateway_chain)
|
|
modules="
|
|
api/pkg
|
|
api/gateway/chain
|
|
"
|
|
;;
|
|
gateway_mntx)
|
|
modules="
|
|
api/pkg
|
|
api/gateway/mntx
|
|
"
|
|
;;
|
|
gateway_tgsettle)
|
|
modules="
|
|
api/pkg
|
|
api/gateway/tgsettle
|
|
"
|
|
;;
|
|
gateway_tron)
|
|
modules="
|
|
api/pkg
|
|
api/gateway/tron
|
|
"
|
|
;;
|
|
ledger)
|
|
modules="
|
|
api/pkg
|
|
api/ledger
|
|
"
|
|
;;
|
|
notification)
|
|
modules="
|
|
api/pkg
|
|
api/notification
|
|
"
|
|
;;
|
|
payments_methods)
|
|
modules="
|
|
api/pkg
|
|
api/payments/storage
|
|
api/payments/methods
|
|
"
|
|
;;
|
|
payments_orchestrator)
|
|
modules="
|
|
api/pkg
|
|
api/payments/storage
|
|
api/payments/orchestrator
|
|
"
|
|
;;
|
|
payments_quotation)
|
|
modules="
|
|
api/pkg
|
|
api/payments/storage
|
|
api/payments/quotation
|
|
"
|
|
;;
|
|
*)
|
|
echo "[backend-tests] unknown service key: ${SERVICE}" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
for module in ${modules}; do
|
|
run_go_tests "${module}"
|
|
done
|