Skip to content

Commit c9269a1

Browse files
authored
Merge pull request #186 from ikappaki/maint/fix-win-int-tests
Fix windows integration tests and reenable in CI
2 parents 8ac45e9 + 4dbb87f commit c9269a1

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ jobs:
5757
os: [ubuntu-22.04]
5858
jdk: [24]
5959
include:
60-
# FIXME
61-
# Windows keep failing randomly because of CI issues.
62-
# - os: windows-latest
63-
# jdk: 24
60+
- os: windows-latest
61+
jdk: 24
6462
- os: macos-latest
6563
jdk: 24
6664
steps:

integration-test/integration/chat/anthropic_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
:origin "native"
231231
:id "tool-1"
232232
:name "eca_directory_tree"
233-
:argumentsText (str "h\":\"" (h/project-path->canon-path "resources") "\"}")
233+
:argumentsText (str "h\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}")
234234
:summary "Listing file tree"})
235235
(match-content chat-id "system" {:type "usage"
236236
:sessionTokens 35

integration-test/integration/chat/commands_test.clj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@
6363
(eca/request! (fixture/initialize-request
6464
{:initializationOptions (merge fixture/default-init-options
6565
{:mcpServers {"mcp-server-sample"
66-
{:command "bash"
67-
:args ["-c" (str "cd " h/mcp-server-sample-path " && clojure -M:server")]}}})}))
66+
(if h/windows?
67+
{:command "cmd.exe"
68+
:args ["/c" (str "cd /d " h/mcp-server-sample-path " && clojure -M:server")]}
69+
{:command "bash"
70+
:args ["-c" (str "cd " h/mcp-server-sample-path " && clojure -M:server")]})}})}))
6871
(eca/notify! (fixture/initialized-notification))
6972

7073
(Thread/sleep 10000) ;; wait MCP server start TODO Improve this

integration-test/integration/chat/openai_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
{:type "function_call"
276276
:name "eca_directory_tree"
277277
:call_id "tool-1"
278-
:arguments (str "{\"path\":\"" (h/project-path->canon-path "resources") "\"}")}
278+
:arguments (str "{\"path\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}")}
279279
{:type "function_call_output"
280280
:call_id "tool-1"
281281
:output (str (h/project-path->canon-path "resources") "\n"

integration-test/integration/helper.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
windows?
4646
(string/replace #"/([a-zA-Z]):/" "/$1%3A/")))
4747

48+
(defn json-escape-path
49+
"Escapes the filesystem PATH string for safe use in JSON and returns the
50+
result."
51+
[path]
52+
(string/replace path "\\" "\\\\"))
53+
4854
(defn file->uri [file]
4955
(let [uri (-> file fs/canonicalize .toUri .toString)]
5056
(if *escape-uris?*

integration-test/llm_mock/anthropic.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
{:type "content_block_delta"
181181
:index 2
182182
:delta {:type "input_json_delta"
183-
:partial_json (str "h\":\"" (h/project-path->canon-path "resources") "\"}")}})
183+
:partial_json (str "h\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}")}})
184184
;; Finish the message indicating a tool_use stop so the client triggers tools
185185
(sse-send! ch "message_delta"
186186
{:type "message_delta"

0 commit comments

Comments
 (0)