Skip to content

Commit 9d2b80a

Browse files
committed
Fix flaky integration tests
1 parent c4542e1 commit 9d2b80a

File tree

15 files changed

+33
-25
lines changed

15 files changed

+33
-25
lines changed

.cljfmt.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
{:extra-indents {task [[:inner 0]]}}
1+
{:extra-indents {task [[:inner 0]]
2+
future* [[:inner 0]]}}

integration-test/integration/chat/anthropic_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
resp))
3131

3232
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
33+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
3334
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
3435
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
3536
(match-content chat-id "assistant" {:type "text" :text "Knock"})
@@ -99,7 +100,6 @@
99100
:lastMessageCost (m/pred string?)
100101
:sessionCost (m/pred string?)})
101102
(match-content chat-id "system" {:type "progress" :state "finished"})
102-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
103103
(is (match?
104104
{:messages [{:role "user" :content [{:type "text" :text "Tell me a joke!"}]}
105105
{:role "assistant" :content [{:type "text" :text "Knock knock!"}]}
@@ -128,6 +128,7 @@
128128
resp))
129129

130130
(match-content chat-id "user" {:type "text" :text "hello!\n"})
131+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
131132
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
132133
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
133134
(match-content chat-id "assistant" {:type "reasonStarted" :id (m/pred string?)})
@@ -141,7 +142,6 @@
141142
:lastMessageCost (m/pred string?)
142143
:sessionCost (m/pred string?)})
143144
(match-content chat-id "system" {:type "progress" :state "finished"})
144-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
145145
(is (match?
146146
{:messages [{:role "user" :content [{:type "text" :text "hello!"}]}]
147147
:system (m/pred vector?)}
@@ -206,6 +206,7 @@
206206
resp))
207207

208208
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})
209+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
209210
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
210211
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
211212
(match-content chat-id "assistant" {:type "reasonStarted" :id (m/pred string?)})
@@ -264,7 +265,6 @@
264265
(match-content chat-id "assistant" {:type "text" :text "The files I see:\n"})
265266
(match-content chat-id "assistant" {:type "text" :text "file1\nfile2\n"})
266267
(match-content chat-id "system" {:type "progress" :state "finished"})
267-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
268268
(is (match?
269269
{:messages [{:role "user" :content [{:type "text" :text "What files you see?"}]}
270270
{:role "assistant"

integration-test/integration/chat/custom_provider_test.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
resp))
4747

4848
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
49+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
4950
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
5051
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
5152
(match-content chat-id "assistant" {:type "text" :text "Knock"})
@@ -158,6 +159,7 @@
158159
resp))
159160

160161
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
162+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
161163
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
162164
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
163165
(match-content chat-id "assistant" {:type "text" :text "Knock "})

integration-test/integration/chat/github_copilot_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
resp))
3232

3333
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
34+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
3435
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
3536
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
3637
(match-content chat-id "assistant" {:type "text" :text "Knock "})
@@ -62,7 +63,6 @@
6263
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
6364
(match-content chat-id "assistant" {:type "text" :text "Foo"})
6465
(match-content chat-id "system" {:type "progress" :state "finished"})
65-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
6666
(is (match?
6767
{:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]}
6868
{:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]}
@@ -84,7 +84,6 @@
8484
:status "prompting"}
8585
resp))
8686

87-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
8887
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
8988
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
9089
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
@@ -124,6 +123,7 @@
124123
resp))
125124

126125
(match-content chat-id "user" {:type "text" :text "hello!\n"})
126+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
127127
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
128128
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
129129
(match-content chat-id "assistant" {:type "reasonStarted" :id (m/pred string?)})

integration-test/integration/chat/google_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
resp))
3232

3333
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
34+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
3435
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
3536
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
3637
(match-content chat-id "assistant" {:type "text" :text "Knoc"})
@@ -62,7 +63,6 @@
6263
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
6364
(match-content chat-id "assistant" {:type "text" :text "Foo"})
6465
(match-content chat-id "system" {:type "progress" :state "finished"})
65-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
6666
(is (match?
6767
{:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]}
6868
{:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]}
@@ -84,7 +84,6 @@
8484
:status "prompting"}
8585
resp))
8686

87-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
8887
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
8988
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
9089
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
@@ -123,6 +122,7 @@
123122
resp))
124123

125124
(match-content chat-id "user" {:type "text" :text "hello!\n"})
125+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
126126
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
127127
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
128128
(match-content chat-id "assistant" {:type "reasonStarted" :id (m/pred string?)})

integration-test/integration/chat/ollama_test.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
resp))
3939

4040
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
41+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
4142
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
4243
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
4344
(match-content chat-id "assistant" {:type "text" :text "Knock"})
@@ -129,6 +130,7 @@
129130
resp))
130131

131132
(match-content chat-id "user" {:type "text" :text "hello!\n"})
133+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
132134
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
133135
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
134136
(match-content chat-id "assistant" {:type "reasonStarted" :id (m/pred string?)})
@@ -205,6 +207,7 @@
205207
resp))
206208

207209
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})
210+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
208211
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
209212
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
210213
(match-content chat-id "assistant" {:type "text" :text "I will list files"})

integration-test/integration/chat/openai_test.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
resp))
3131

3232
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
33+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
3334
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
3435
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
3536
(match-content chat-id "assistant" {:type "text" :text "Knock"})
@@ -39,7 +40,6 @@
3940
:lastMessageCost (m/pred string?)
4041
:sessionCost (m/pred string?)})
4142
(match-content chat-id "system" {:type "progress" :state "finished"})
42-
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
4343
(is (match?
4444
{:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]}]
4545
:instructions (m/pred string?)}
@@ -128,6 +128,7 @@
128128
resp))
129129

130130
(match-content chat-id "user" {:type "text" :text "hello!\n"})
131+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
131132
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
132133
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
133134
(match-content chat-id "assistant" {:type "reasonStarted" :id "123"})
@@ -205,6 +206,7 @@
205206
resp))
206207

207208
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})
209+
(match-content chat-id "system" {:type "metadata" :title "Some Cool Title"})
208210
(match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"})
209211
(match-content chat-id "system" {:type "progress" :state "running" :text "Generating"})
210212
(match-content chat-id "assistant" {:type "reasonStarted" :id "123"})

integration-test/integration/fixture.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
:keyEnv "FOO"}})
2323

2424
(def default-init-options {:pureConfig true
25+
:env "test"
2526
:toolCall {:approval {:byDefault "allow"}}
2627
:providers default-providers})
2728

integration-test/llm_mock/anthropic.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@
224224
"Connection" "keep-alive"}}
225225
false)
226226
(if (string/includes? (:text (last (:system body))) llm.mocks/chat-title-generator-str)
227-
(do
228-
(Thread/sleep 2000) ;; avoid tests failing with mismatch order of contents
229-
(chat-title-text-0 ch))
227+
(chat-title-text-0 ch)
230228
(do
231229
(llm.mocks/set-req-body! llm.mocks/*case* body)
232230
(case llm.mocks/*case*

integration-test/llm_mock/ollama.clj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@
8181
"Connection" "keep-alive"}}
8282
false)
8383
(if (string/includes? (:content (first (:messages body))) llm.mocks/chat-title-generator-str)
84-
(do
85-
(Thread/sleep 2000) ;; avoid tests failing with mismatch order of contents
86-
(chat-title-text-0 ch))
84+
(chat-title-text-0 ch)
8785
(do
8886
(llm.mocks/set-req-body! llm.mocks/*case* body)
8987
(case llm.mocks/*case*

0 commit comments

Comments
 (0)