[GH-ISSUE #1613] Test_Routes Version Handler assertion fails #896

Closed
opened 2026-04-12 10:34:04 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @alinanorakari on GitHub (Dec 19, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1613

Originally assigned to: @mxyng on GitHub.

this assertion fails when I try to build the project:

1ca484f67e/server/routes_test.go (L74)

Error:

[GIN] 2023/12/19 - 19:11:41 | 200 |      56.659µs |       127.0.0.1 | GET      "/api/version"

[...]

--- FAIL: Test_Routes (0.00s)
    routes_test.go:185: Running Test: [Version Handler]
    routes_test.go:74: 
                Error Trace:    /build/source/server/routes_test.go:74
                                                        /build/source/server/routes_test.go:199
                Error:          Not equal: 
                                expected: "{\"version\":\"0.0.0\"}"
                                actual  : "{\"version\":\"0.1.17\"}"
                                
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -{"version":"0.0.0"}
                                +{"version":"0.1.17"}
                Test:           Test_Routes

Either I don't fully understand how the assertion is supposed to work and I am doing something wrong or the version string "0.0.0" in this assertion should be "0.1.17".

Originally created by @alinanorakari on GitHub (Dec 19, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1613 Originally assigned to: @mxyng on GitHub. this assertion fails when I try to build the project: https://github.com/jmorganca/ollama/blame/1ca484f67e6f607114496211004942013e5595eb/server/routes_test.go#L74 Error: ``` [GIN] 2023/12/19 - 19:11:41 | 200 | 56.659µs | 127.0.0.1 | GET "/api/version" ``` [...] ``` --- FAIL: Test_Routes (0.00s) routes_test.go:185: Running Test: [Version Handler] routes_test.go:74: Error Trace: /build/source/server/routes_test.go:74 /build/source/server/routes_test.go:199 Error: Not equal: expected: "{\"version\":\"0.0.0\"}" actual : "{\"version\":\"0.1.17\"}" Diff: --- Expected +++ Actual @@ -1 +1 @@ -{"version":"0.0.0"} +{"version":"0.1.17"} Test: Test_Routes ``` Either I don't fully understand how the assertion is supposed to work and I am doing something wrong or the version string `"0.0.0"` in this assertion should be `"0.1.17"`.
Author
Owner

@mxyng commented on GitHub (Dec 19, 2023):

How are you running the unit tests? The version string is set to 0.0.0 statically and modified during build time for releases. The expected value is 0.0.0 for this case.

<!-- gh-comment-id:1863529600 --> @mxyng commented on GitHub (Dec 19, 2023): How are you running the unit tests? The version string is set to 0.0.0 statically and modified during build time for releases. The expected value is 0.0.0 for this case.
Author
Owner

@alinanorakari commented on GitHub (Dec 19, 2023):

I'm building it as a Nix package via Nix' built in buildGoPackage, which automatically runs the tests. I'm not very deep into how Nix handles this behind the scenes. This is the implementation https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/go/package.nix

To me it looks like lines 238-240 in th checkPhase are responsible for running the tests:

      for pkg in $(getGoDirs test); do
        buildGoDir test "$pkg"
      done

I can manually disable the checkPhase, but I'd rather have it run the tests as intended

<!-- gh-comment-id:1863537122 --> @alinanorakari commented on GitHub (Dec 19, 2023): I'm building it as a Nix package via Nix' built in `buildGoPackage`, which automatically runs the tests. I'm not very deep into how Nix handles this behind the scenes. This is the implementation https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/go/package.nix To me it looks like lines 238-240 in th checkPhase are responsible for running the tests: ``` for pkg in $(getGoDirs test); do buildGoDir test "$pkg" done ``` I can manually disable the checkPhase, but I'd rather have it run the tests as intended
Author
Owner

@mxyng commented on GitHub (Dec 19, 2023):

I see. It looks like it passes the same build flags to go test as go build thereby changing the Version value.

<!-- gh-comment-id:1863594399 --> @mxyng commented on GitHub (Dec 19, 2023): I see. It looks like it passes the same build flags to `go test` as `go build` thereby changing the Version value.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#896