Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
03bdac05
Unverified
Commit
03bdac05
authored
Aug 05, 2024
by
Michael Yang
Committed by
GitHub
Aug 05, 2024
Browse files
Merge pull request #6146 from ollama/mxyng/testing
use testing tempdirs
parents
39f2bc6b
a091fadf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
server/routes_create_test.go
server/routes_create_test.go
+3
-0
No files found.
server/routes_create_test.go
View file @
03bdac05
...
@@ -2,6 +2,7 @@ package server
...
@@ -2,6 +2,7 @@ package server
import
(
import
(
"bytes"
"bytes"
"cmp"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io"
"io"
...
@@ -53,6 +54,8 @@ func (t *responseRecorder) CloseNotify() <-chan bool {
...
@@ -53,6 +54,8 @@ func (t *responseRecorder) CloseNotify() <-chan bool {
func
createRequest
(
t
*
testing
.
T
,
fn
func
(
*
gin
.
Context
),
body
any
)
*
httptest
.
ResponseRecorder
{
func
createRequest
(
t
*
testing
.
T
,
fn
func
(
*
gin
.
Context
),
body
any
)
*
httptest
.
ResponseRecorder
{
t
.
Helper
()
t
.
Helper
()
// if OLLAMA_MODELS is not set, set it to the temp directory
t
.
Setenv
(
"OLLAMA_MODELS"
,
cmp
.
Or
(
os
.
Getenv
(
"OLLAMA_MODELS"
),
t
.
TempDir
()))
w
:=
NewRecorder
()
w
:=
NewRecorder
()
c
,
_
:=
gin
.
CreateTestContext
(
w
)
c
,
_
:=
gin
.
CreateTestContext
(
w
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment