Skip to content

Commit 2e2a5c1

Browse files
chore(internal): switch mock server from steady to prism
1 parent 6d46483 commit 2e2a5c1

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 190
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-17c04dd1b0508b380c21e3acc3d4cd1e86b590f81d14fa26d1973b236f660e38.yml
33
openapi_spec_hash: f8ddee07358d2c938450a6889fbf7940
4-
config_hash: 400b9afe0f7f7b7d96177d05950775f9
4+
config_hash: edbdfefeb0d3d927c2f9fe3402793215

scripts/mock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ fi
1919

2020
echo "==> Starting mock server with URL ${URL}"
2121

22-
# Run steady mock on the given spec
22+
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
2424
# Pre-install the package so the download doesn't eat into the startup timeout
25-
npm exec --package=@stdy/cli@0.19.6 -- steady --version
25+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
2626

27-
npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log &
27+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
2828

29-
# Wait for server to come online via health endpoint (max 30s)
29+
# Wait for server to come online (max 30s)
3030
echo -n "Waiting for server"
3131
attempts=0
32-
while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
33-
if ! kill -0 $! 2>/dev/null; then
34-
echo
35-
cat .stdy.log
36-
exit 1
37-
fi
32+
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
3833
attempts=$((attempts + 1))
3934
if [ "$attempts" -ge 300 ]; then
4035
echo
41-
echo "Timed out waiting for Steady server to start"
42-
cat .stdy.log
36+
echo "Timed out waiting for Prism server to start"
37+
cat .prism.log
4338
exit 1
4439
fi
4540
echo -n "."
4641
sleep 0.1
4742
done
4843

44+
if grep -q "✖ fatal" ".prism.log"; then
45+
cat .prism.log
46+
exit 1
47+
fi
48+
4949
echo
5050
else
51-
npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL"
51+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
5252
fi

scripts/test

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ GREEN='\033[0;32m'
99
YELLOW='\033[0;33m'
1010
NC='\033[0m' # No Color
1111

12-
function steady_is_running() {
13-
curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
12+
function prism_is_running() {
13+
curl --silent "http://localhost:4010" >/dev/null 2>&1
1414
}
1515

1616
kill_server_on_port() {
@@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
2525
[ -n "$TEST_API_BASE_URL" ]
2626
}
2727

28-
if ! is_overriding_api_base_url && ! steady_is_running ; then
28+
if ! is_overriding_api_base_url && ! prism_is_running ; then
2929
# When we exit this script, make sure to kill the background mock server process
3030
trap 'kill_server_on_port 4010' EXIT
3131

@@ -36,19 +36,19 @@ fi
3636
if is_overriding_api_base_url ; then
3737
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
3838
echo
39-
elif ! steady_is_running ; then
40-
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server"
39+
elif ! prism_is_running ; then
40+
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
4141
echo -e "running against your OpenAPI spec."
4242
echo
4343
echo -e "To run the server, pass in the path or url of your OpenAPI"
44-
echo -e "spec to the steady command:"
44+
echo -e "spec to the prism command:"
4545
echo
46-
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}"
46+
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
4747
echo
4848

4949
exit 1
5050
else
51-
echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}"
51+
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
5252
echo
5353
fi
5454

0 commit comments

Comments
 (0)