summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/sdk/internal/testutil
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-07-03 11:49:15 -0500
committeradamdottv <[email protected]>2025-07-03 11:49:15 -0500
commit5a0910ea79b3f219c64f922fc775636b2bfdf07c (patch)
tree6f3288101eb3aa99fdc31cfaf5e07e4990cc8954 /packages/tui/sdk/internal/testutil
parent1dffabcfdaeefd3bc08a51b625047185bade3a4d (diff)
downloadopencode-5a0910ea79b3f219c64f922fc775636b2bfdf07c.tar.gz
opencode-5a0910ea79b3f219c64f922fc775636b2bfdf07c.zip
chore: better local dev with stainless script
Diffstat (limited to 'packages/tui/sdk/internal/testutil')
-rw-r--r--packages/tui/sdk/internal/testutil/testutil.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/tui/sdk/internal/testutil/testutil.go b/packages/tui/sdk/internal/testutil/testutil.go
new file mode 100644
index 000000000..826d266f2
--- /dev/null
+++ b/packages/tui/sdk/internal/testutil/testutil.go
@@ -0,0 +1,27 @@
+package testutil
+
+import (
+ "net/http"
+ "os"
+ "strconv"
+ "testing"
+)
+
+func CheckTestServer(t *testing.T, url string) bool {
+ if _, err := http.Get(url); err != nil {
+ const SKIP_MOCK_TESTS = "SKIP_MOCK_TESTS"
+ if str, ok := os.LookupEnv(SKIP_MOCK_TESTS); ok {
+ skip, err := strconv.ParseBool(str)
+ if err != nil {
+ t.Fatalf("strconv.ParseBool(os.LookupEnv(%s)) failed: %s", SKIP_MOCK_TESTS, err)
+ }
+ if skip {
+ t.Skip("The test will not run without a mock Prism server running against your OpenAPI spec")
+ return false
+ }
+ t.Errorf("The test will not run without a mock Prism server running against your OpenAPI spec. You can set the environment variable %s to true to skip running any tests that require the mock server", SKIP_MOCK_TESTS)
+ return false
+ }
+ }
+ return true
+}