Spaces:
Sleeping
Sleeping
update: Add Production Proxies Testing
Browse files- Makefile +3 -85
- endpoints_test.sh +59 -0
- traefik/dynamic.yaml +1 -1
Makefile
CHANGED
|
@@ -23,6 +23,9 @@ traefik-test:
|
|
| 23 |
--api.dashboard=true \
|
| 24 |
--api.insecure=false
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
#
|
| 27 |
# --- Development Testing ---
|
| 28 |
#
|
|
@@ -51,88 +54,3 @@ natcurr-prediction-test:
|
|
| 51 |
-H "Content-Type: application/json" \
|
| 52 |
-d "{\"days\": 2, \"currency\": \"BTC-USD\"}"
|
| 53 |
|
| 54 |
-
|
| 55 |
-
#
|
| 56 |
-
# --- Production Testing (Proxy 0) ---
|
| 57 |
-
#
|
| 58 |
-
|
| 59 |
-
stock-list-prod-0:
|
| 60 |
-
curl -X GET $(PROD_ENDPOINT_0)/stock/lists
|
| 61 |
-
|
| 62 |
-
stock-prediction-prod-0:
|
| 63 |
-
curl -X POST $(PROD_ENDPOINT_0)/stock/prediction \
|
| 64 |
-
-H "Content-Type: application/json" \
|
| 65 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 66 |
-
|
| 67 |
-
crypto-list-prod-0:
|
| 68 |
-
curl -X GET $(PROD_ENDPOINT_0)/crypto/lists
|
| 69 |
-
|
| 70 |
-
crypto-prediction-prod-0:
|
| 71 |
-
curl -X POST $(PROD_ENDPOINT_0)/crypto/prediction \
|
| 72 |
-
-H "Content-Type: application/json" \
|
| 73 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 74 |
-
|
| 75 |
-
natcurr-list-prod-0:
|
| 76 |
-
curl -X GET $(PROD_ENDPOINT_0)/national-currency/lists
|
| 77 |
-
|
| 78 |
-
natcurr-prediction-prod-0:
|
| 79 |
-
curl -X POST $(PROD_ENDPOINT_0)/national-currency/prediction \
|
| 80 |
-
-H "Content-Type: application/json" \
|
| 81 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 82 |
-
|
| 83 |
-
#
|
| 84 |
-
# --- Production Testing (Proxy 1) ---
|
| 85 |
-
#
|
| 86 |
-
|
| 87 |
-
stock-list-prod-1:
|
| 88 |
-
curl -X GET $(PROD_ENDPOINT_1)/stock/lists
|
| 89 |
-
|
| 90 |
-
stock-prediction-prod-1:
|
| 91 |
-
curl -X POST $(PROD_ENDPOINT_1)/stock/prediction \
|
| 92 |
-
-H "Content-Type: application/json" \
|
| 93 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 94 |
-
|
| 95 |
-
crypto-list-prod-1:
|
| 96 |
-
curl -X GET $(PROD_ENDPOINT_1)/crypto/lists
|
| 97 |
-
|
| 98 |
-
crypto-prediction-prod-1:
|
| 99 |
-
curl -X POST $(PROD_ENDPOINT_1)/crypto/prediction \
|
| 100 |
-
-H "Content-Type: application/json" \
|
| 101 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 102 |
-
|
| 103 |
-
natcurr-list-prod-1:
|
| 104 |
-
curl -X GET $(PROD_ENDPOINT_1)/national-currency/lists
|
| 105 |
-
|
| 106 |
-
natcurr-prediction-prod-1:
|
| 107 |
-
curl -X POST $(PROD_ENDPOINT_1)/national-currency/prediction \
|
| 108 |
-
-H "Content-Type: application/json" \
|
| 109 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 110 |
-
|
| 111 |
-
#
|
| 112 |
-
# --- Production Testing (Proxy 2) ---
|
| 113 |
-
#
|
| 114 |
-
|
| 115 |
-
stock-list-prod-2:
|
| 116 |
-
curl -X GET $(PROD_ENDPOINT_2)/stock/lists
|
| 117 |
-
|
| 118 |
-
stock-prediction-prod-2:
|
| 119 |
-
curl -X POST $(PROD_ENDPOINT_2)/stock/prediction \
|
| 120 |
-
-H "Content-Type: application/json" \
|
| 121 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 122 |
-
|
| 123 |
-
crypto-list-prod-2:
|
| 124 |
-
curl -X GET $(PROD_ENDPOINT_2)/crypto/lists
|
| 125 |
-
|
| 126 |
-
crypto-prediction-prod-2:
|
| 127 |
-
curl -X POST $(PROD_ENDPOINT_2)/crypto/prediction \
|
| 128 |
-
-H "Content-Type: application/json" \
|
| 129 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 130 |
-
|
| 131 |
-
natcurr-list-prod-2:
|
| 132 |
-
curl -X GET $(PROD_ENDPOINT_2)/national-currency/lists
|
| 133 |
-
|
| 134 |
-
natcurr-prediction-prod-2:
|
| 135 |
-
curl -X POST $(PROD_ENDPOINT_2)/national-currency/prediction \
|
| 136 |
-
-H "Content-Type: application/json" \
|
| 137 |
-
-d "{\"days\": 7, \"currency\": \"BTC-USD\"}"
|
| 138 |
-
|
|
|
|
| 23 |
--api.dashboard=true \
|
| 24 |
--api.insecure=false
|
| 25 |
|
| 26 |
+
endpoints_check:
|
| 27 |
+
bash -c 'chmod +x endpoints_test.sh && ./endpoints_test.sh'
|
| 28 |
+
|
| 29 |
#
|
| 30 |
# --- Development Testing ---
|
| 31 |
#
|
|
|
|
| 54 |
-H "Content-Type: application/json" \
|
| 55 |
-d "{\"days\": 2, \"currency\": \"BTC-USD\"}"
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endpoints_test.sh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
PROD_ENDPOINT_0="https://qywok-tebakaja-proxy-space-0.hf.space"
|
| 3 |
+
PROD_ENDPOINT_1="https://qywok-tebakaja-proxy-space-1.hf.space"
|
| 4 |
+
PROD_ENDPOINT_2="https://qywok-tebakaja-proxy-space-2.hf.space"
|
| 5 |
+
|
| 6 |
+
check_status() {
|
| 7 |
+
if [ $1 -eq 200 ]; then
|
| 8 |
+
echo "[ Success ] $2 (latency: $3 ms)"
|
| 9 |
+
else
|
| 10 |
+
echo "[ Failed ] $2 (HTTP status: $1)"
|
| 11 |
+
fi
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
# GET Request
|
| 15 |
+
make_get_request() {
|
| 16 |
+
START_TIME=$(date +%s%3N)
|
| 17 |
+
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X GET $1)
|
| 18 |
+
END_TIME=$(date +%s%3N)
|
| 19 |
+
DURATION=$((END_TIME - START_TIME))
|
| 20 |
+
check_status $RESPONSE $2 $DURATION
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# POST Request
|
| 24 |
+
make_post_request() {
|
| 25 |
+
START_TIME=$(date +%s%3N)
|
| 26 |
+
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST $1 \
|
| 27 |
+
-H "Content-Type: application/json" \
|
| 28 |
+
-d "$2")
|
| 29 |
+
END_TIME=$(date +%s%3N)
|
| 30 |
+
DURATION=$((END_TIME - START_TIME))
|
| 31 |
+
check_status $RESPONSE $3 $DURATION
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
echo "-------- [ Proxy 0 ] --------"
|
| 35 |
+
make_get_request "$PROD_ENDPOINT_0/stock/lists" "stock-list-prod-0"
|
| 36 |
+
make_post_request "$PROD_ENDPOINT_0/stock/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "stock-prediction-prod-0"
|
| 37 |
+
make_get_request "$PROD_ENDPOINT_0/crypto/lists" "crypto-list-prod-0"
|
| 38 |
+
make_post_request "$PROD_ENDPOINT_0/crypto/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "crypto-prediction-prod-0"
|
| 39 |
+
make_get_request "$PROD_ENDPOINT_0/national-currency/lists" "natcurr-list-prod-0"
|
| 40 |
+
make_post_request "$PROD_ENDPOINT_0/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-0"
|
| 41 |
+
echo " "
|
| 42 |
+
|
| 43 |
+
echo "-------- [ Proxy 1 ] --------"
|
| 44 |
+
make_get_request "$PROD_ENDPOINT_1/stock/lists" "stock-list-prod-1"
|
| 45 |
+
make_post_request "$PROD_ENDPOINT_1/stock/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "stock-prediction-prod-1"
|
| 46 |
+
make_get_request "$PROD_ENDPOINT_1/crypto/lists" "crypto-list-prod-1"
|
| 47 |
+
make_post_request "$PROD_ENDPOINT_1/crypto/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "crypto-prediction-prod-1"
|
| 48 |
+
make_get_request "$PROD_ENDPOINT_1/national-currency/lists" "natcurr-list-prod-1"
|
| 49 |
+
make_post_request "$PROD_ENDPOINT_1/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-1"
|
| 50 |
+
echo " "
|
| 51 |
+
|
| 52 |
+
echo "-------- [ Proxy 2 ] --------"
|
| 53 |
+
make_get_request "$PROD_ENDPOINT_2/stock/lists" "stock-list-prod-2"
|
| 54 |
+
make_post_request "$PROD_ENDPOINT_2/stock/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "stock-prediction-prod-2"
|
| 55 |
+
make_get_request "$PROD_ENDPOINT_2/crypto/lists" "crypto-list-prod-2"
|
| 56 |
+
make_post_request "$PROD_ENDPOINT_2/crypto/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "crypto-prediction-prod-2"
|
| 57 |
+
make_get_request "$PROD_ENDPOINT_2/national-currency/lists" "natcurr-list-prod-2"
|
| 58 |
+
make_post_request "$PROD_ENDPOINT_2/national-currency/prediction" "{\"days\": 7, \"currency\": \"BTC-USD\"}" "natcurr-prediction-prod-2"
|
| 59 |
+
echo " "
|
traefik/dynamic.yaml
CHANGED
|
@@ -3,7 +3,7 @@ http:
|
|
| 3 |
dashboard-auth:
|
| 4 |
basicAuth:
|
| 5 |
users:
|
| 6 |
-
|
| 7 |
|
| 8 |
rate-limit:
|
| 9 |
rateLimit:
|
|
|
|
| 3 |
dashboard-auth:
|
| 4 |
basicAuth:
|
| 5 |
users:
|
| 6 |
+
- "admin:$apr1$vO3/IDvg$JrbhU9NSQub83/mQu9/fP1"
|
| 7 |
|
| 8 |
rate-limit:
|
| 9 |
rateLimit:
|