|
@@ -14,6 +14,7 @@ import (
|
|
|
"testing"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
+ "github.com/google/go-cmp/cmp"
|
|
|
"github.com/ollama/ollama/api"
|
|
|
"github.com/ollama/ollama/envconfig"
|
|
|
"github.com/ollama/ollama/llm"
|
|
@@ -79,8 +80,11 @@ func checkFileExists(t *testing.T, p string, expect []string) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if !slices.Equal(actual, expect) {
|
|
|
- t.Fatalf("expected slices to be equal %v", actual)
|
|
|
+ slices.Sort(actual)
|
|
|
+ slices.Sort(expect)
|
|
|
+
|
|
|
+ if diff := cmp.Diff(actual, expect); diff != "" {
|
|
|
+ t.Errorf("mismatch (-got, +want):\n%s", diff)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -101,7 +105,7 @@ func TestCreateFromBin(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -127,7 +131,7 @@ func TestCreateFromModel(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
w = createRequest(t, s.CreateModelHandler, api.CreateRequest{
|
|
@@ -141,8 +145,8 @@ func TestCreateFromModel(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test2", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test2", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -168,7 +172,7 @@ func TestCreateRemovesLayers(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -188,7 +192,7 @@ func TestCreateRemovesLayers(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -215,7 +219,7 @@ func TestCreateUnsetsSystem(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -235,7 +239,7 @@ func TestCreateUnsetsSystem(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -271,7 +275,7 @@ func TestCreateMergeParameters(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -292,8 +296,8 @@ func TestCreateMergeParameters(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test2", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test2", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -330,8 +334,8 @@ func TestCreateMergeParameters(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test2", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test2", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -374,7 +378,7 @@ func TestCreateReplacesMessages(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -394,8 +398,8 @@ func TestCreateReplacesMessages(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test2", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test2", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -450,7 +454,7 @@ func TestCreateTemplateSystem(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|
|
@@ -496,7 +500,7 @@ func TestCreateLicenses(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "manifests", "*", "*", "*", "*"), []string{
|
|
|
- filepath.Join(p, "manifests", "registry.ollama.ai", "library", "test", "latest"),
|
|
|
+ filepath.Join(p, "manifests", "ollama.com", "library", "test", "latest"),
|
|
|
})
|
|
|
|
|
|
checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{
|