-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_all.ps1
More file actions
62 lines (59 loc) · 2.06 KB
/
Copy pathtest_all.ps1
File metadata and controls
62 lines (59 loc) · 2.06 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
$base = "http://localhost:8080"
$ok = 0; $err = 0
$tests = @(
"POST /promotion/sync/campaigns/full",
"POST /promotion/sync/stats/full",
"POST /promotion/sync/calendar/full",
"GET /promotion/db/campaigns/",
"GET /promotion/db/stats/",
"GET /promotion/db/calendar/",
"POST /communications/sync/feedbacks/full",
"POST /communications/sync/questions/full",
"POST /communications/sync/claims/full",
"GET /communications/db/feedbacks/",
"GET /communications/db/questions/",
"GET /communications/db/claims/",
"POST /tariffs/sync/commissions/full",
"POST /tariffs/sync/box/full",
"POST /tariffs/sync/pallet/full",
"POST /tariffs/sync/supply/full",
"GET /tariffs/db/commissions/",
"GET /tariffs/db/box/",
"GET /tariffs/db/pallet/",
"GET /tariffs/db/supply/",
"POST /analytics/sync/funnel/full",
"POST /analytics/sync/stocks/full",
"GET /analytics/db/funnel/",
"GET /analytics/db/stocks/",
"POST /reports/sync/stocks/full",
"POST /reports/sync/orders/full",
"POST /reports/sync/sales/full",
"GET /reports/db/stocks/",
"GET /reports/db/orders/",
"GET /reports/db/sales/",
"POST /finances/sync/full/",
"POST /finances/sync/incremental/",
"GET /finances/db/"
)
foreach ($line in $tests) {
$parts = $line.Trim().Split(" ", 2)
$method = $parts[0].Trim()
$path = $parts[1].Trim()
try {
$resp = Invoke-WebRequest -Method $method -Uri "$base$path" -TimeoutSec 30 -ErrorAction Stop
$j = $resp.Content | ConvertFrom-Json
$extra = ""
if ($null -ne $j.synced) { $extra = "synced=$($j.synced)" }
elseif ($null -ne $j.task_id) { $extra = "queued" }
elseif ($null -ne $j.total) { $extra = "total=$($j.total)" }
else { $extra = "ok" }
Write-Host "OK $($resp.StatusCode) $method $path => $extra"
$ok++
} catch {
$code = $_.Exception.Response.StatusCode.value__
Write-Host "ERR $method $path => $code"
$err++
}
}
Write-Host ""
Write-Host "TOTAL: $ok OK, $err ERR"