MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / runIteration

Function runIteration

scripts/stress/simdeck.mjs:133–160  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

131}
132
133async function runIteration(index) {
134 const endpoints = [
135 ["GET", "/api/health"],
136 ["GET", "/api/metrics"],
137 ["GET", "/api/simulators"],
138 ["GET", "/api/stream-quality"],
139 ];
140 if (udid) {
141 endpoints.push(["GET", `/api/simulators/${encodeURIComponent(udid)}`]);
142 if (index % 5 === 0) {
143 endpoints.push([
144 "POST",
145 `/api/simulators/${encodeURIComponent(udid)}/stream/refresh`,
146 {},
147 ]);
148 }
149 if (mutating && index % 10 === 0) {
150 endpoints.push([
151 "POST",
152 `/api/simulators/${encodeURIComponent(udid)}/action`,
153 { action: "touch", x: 0.5, y: 0.5, phase: "moved" },
154 ]);
155 }
156 }
157
158 const [method, path, body] = endpoints[index % endpoints.length];
159 await request(method, path, body);
160}
161
162async function assertHealthy() {
163 const health = await request("GET", "/api/health");

Callers 1

simdeck.mjsFile · 0.70

Calls 1

requestFunction · 0.85

Tested by

no test coverage detected