@@ -141,13 +141,49 @@ func testIntegration(t *testing.T, when spec.G, it spec.S) {
141
141
Expect (err ).NotTo (HaveOccurred ())
142
142
})
143
143
144
- it ("reads the config from the file" , func () {
145
- err = configIO .Write (testConfig ) // need to write before reading
146
- Expect (err ).NotTo (HaveOccurred ())
144
+ when ("reading the config from a file" , func () {
145
+ defaults := config .New ().ReadDefaults ()
147
146
148
- readConfig , err := configIO .Read ()
149
- Expect (err ).NotTo (HaveOccurred ())
150
- Expect (readConfig ).To (Equal (testConfig ))
147
+ it ("it doesn't apply a migration when max_tokens is 0" , func () {
148
+ testConfig .MaxTokens = 0
149
+
150
+ err = configIO .Write (testConfig ) // need to write before reading
151
+ Expect (err ).NotTo (HaveOccurred ())
152
+
153
+ readConfig , err := configIO .Read ()
154
+ Expect (err ).NotTo (HaveOccurred ())
155
+ Expect (readConfig ).To (Equal (testConfig ))
156
+ })
157
+ it ("it migrates small values of max_tokens as expected" , func () {
158
+ testConfig .MaxTokens = defaults .ContextWindow - 1
159
+
160
+ err = configIO .Write (testConfig ) // need to write before reading
161
+ Expect (err ).NotTo (HaveOccurred ())
162
+
163
+ readConfig , err := configIO .Read ()
164
+ Expect (err ).NotTo (HaveOccurred ())
165
+
166
+ expectedConfig := testConfig
167
+ expectedConfig .MaxTokens = defaults .MaxTokens
168
+ expectedConfig .ContextWindow = defaults .ContextWindow
169
+
170
+ Expect (readConfig ).To (Equal (expectedConfig ))
171
+ })
172
+ it ("it migrates large values of max_tokens as expected" , func () {
173
+ testConfig .MaxTokens = defaults .ContextWindow + 1
174
+
175
+ err = configIO .Write (testConfig ) // need to write before reading
176
+ Expect (err ).NotTo (HaveOccurred ())
177
+
178
+ readConfig , err := configIO .Read ()
179
+ Expect (err ).NotTo (HaveOccurred ())
180
+
181
+ expectedConfig := testConfig
182
+ expectedConfig .MaxTokens = defaults .MaxTokens
183
+ expectedConfig .ContextWindow = testConfig .MaxTokens
184
+
185
+ Expect (readConfig ).To (Equal (expectedConfig ))
186
+ })
151
187
})
152
188
153
189
it ("lists all the threads" , func () {
0 commit comments