Skip to content

test suite fails on 32 bit #74

Description

@deep-42-thought

The test suite (runhaskell Setup test) fails on archlinux32:

Running 2 test suites...
Test suite doctests: RUNNING...
### Failure in /build/haskell-servant-swagger/src/servant-swagger-1.1.4/src/Servant/Swagger.hs:100: expression `BSL8.putStrLn $ encode $ toSwagger (Proxy :: Proxy UserAPI)'
expected: {"swagger":"2.0","info":{"version":"","title":""},"paths":{"/":{"get":{"produces":["application/json;charset=utf-8"],"responses":{"200":{"schema":{"items":{"$ref":"#/definitions/User"},"type":"array"},"description":""}}},"post":{"consumes":["application/json;charset=utf-8"],"produces":["application/json;charset=utf-8"],"parameters":[{"required":true,"schema":{"$ref":"#/definitions/User"},"in":"body","name":"body"}],"responses":{"400":{"description":"Invalid `body`"},"200":{"schema":{"$ref":"#/definitions/UserId"},"description":""}}}},"/{user_id}":{"get":{"produces":["application/json;charset=utf-8"],"parameters":[{"required":true,"in":"path","name":"user_id","type":"integer"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"schema":{"$ref":"#/definitions/User"},"description":""}}}}},"definitions":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},"type":"object"},"UserId":{"type":"integer"}}}
 but got: {"swagger":"2.0","info":{"version":"","title":""},"paths":{"/":{"get":{"produces":["application/json;charset=utf-8"],"responses":{"200":{"description":"","schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}}},"post":{"consumes":["application/json;charset=utf-8"],"produces":["application/json;charset=utf-8"],"parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid `body`"},"200":{"description":"","schema":{"$ref":"#/definitions/UserId"}}}}},"/{user_id}":{"get":{"produces":["application/json;charset=utf-8"],"parameters":[{"name":"user_id","in":"path","type":"integer","required":true}],"responses":{"200":{"description":"","schema":{"$ref":"#/definitions/User"}},"404":{"description":"`user_id` not found"}}}}},"definitions":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"type":"integer","maximum":2147483647,"minimum":-2147483648}},"type":"object"},"UserId":{"type":"integer"}}}
### Failure in /build/haskell-servant-swagger/src/servant-swagger-1.1.4/src/Servant/Swagger.hs:114: expression `:{
 BSL8.putStrLn $ encode $ toSwagger (Proxy :: Proxy UserAPI)
   & info.title        .~ "User API"
   & info.version      .~ "1.0"
   & info.description  ?~ "This is an API for the Users service"
   & info.license      ?~ "MIT"
   & host              ?~ "example.com"
:}'
expected: {"swagger":"2.0","info":{"version":"1.0","title":"User API","license":{"name":"MIT"},"description":"This is an API for the Users service"},"host":"example.com","paths":{"/":{"get":{"produces":["application/json;charset=utf-8"],"responses":{"200":{"schema":{"items":{"$ref":"#/definitions/User"},"type":"array"},"description":""}}},"post":{"consumes":["application/json;charset=utf-8"],"produces":["application/json;charset=utf-8"],"parameters":[{"required":true,"schema":{"$ref":"#/definitions/User"},"in":"body","name":"body"}],"responses":{"400":{"description":"Invalid `body`"},"200":{"schema":{"$ref":"#/definitions/UserId"},"description":""}}}},"/{user_id}":{"get":{"produces":["application/json;charset=utf-8"],"parameters":[{"required":true,"in":"path","name":"user_id","type":"integer"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"schema":{"$ref":"#/definitions/User"},"description":""}}}}},"definitions":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},"type":"object"},"UserId":{"type":"integer"}}}
 but got: {"swagger":"2.0","info":{"version":"1.0","title":"User API","license":{"name":"MIT"},"description":"This is an API for the Users service"},"host":"example.com","paths":{"/":{"get":{"produces":["application/json;charset=utf-8"],"responses":{"200":{"description":"","schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}}},"post":{"consumes":["application/json;charset=utf-8"],"produces":["application/json;charset=utf-8"],"parameters":[{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid `body`"},"200":{"description":"","schema":{"$ref":"#/definitions/UserId"}}}}},"/{user_id}":{"get":{"produces":["application/json;charset=utf-8"],"parameters":[{"name":"user_id","in":"path","type":"integer","required":true}],"responses":{"200":{"description":"","schema":{"$ref":"#/definitions/User"}},"404":{"description":"`user_id` not found"}}}}},"definitions":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"type":"integer","maximum":2147483647,"minimum":-2147483648}},"type":"object"},"UserId":{"type":"integer"}}}
Examples: 82  Tried: 79  Errors: 0  Failures: 2
-i
-i/build/haskell-servant-swagger/src/servant-swagger-1.1.4/dist/build/autogen
-i/build/haskell-servant-swagger/src/servant-swagger-1.1.4/dist/build
-i/build/haskell-servant-swagger/src/servant-swagger-1.1.4/src
-hide-all-packages
-no-user-package-db
-package-db=dist/package.conf.inplace
-optP-include
-optPdist/build/autogen/cabal_macros.h
-dynamic
-package-id=aeson-1.2.3.0-LNkLuLvRI8W9I8ocVQs80F
-package-id=base-4.10.1.0
-package-id=bytestring-0.10.8.2
-package-id=http-media-0.7.1.1-7GtPrLmWejF6Fjt4ApRnO
-package-id=insert-ordered-containers-0.2.1.0-1Lr5msjClbgJ7Nl88fZnTI
-package-id=lens-4.15.4-6GPYoGX8D8oF6KL1aYwOV5
-package-id=servant-0.12-LcZvI9SZLHs65xgOJN7f8C
-package-id=swagger2-2.2-HzBtyI0v9pD3DCwDqi5mOk
-package-id=text-1.2.2.2-E3rQA0mJl73IvZIzvmwqAj
-package-id=unordered-containers-0.2.8.0-I4wGGMV7X9X97sk1hrOqCV
-package-id=hspec-2.4.4-3z52NchwlP1GVFMSTdNOx4
-package-id=QuickCheck-2.10.1-BUFYQzp5Pjm7JbQeTzW89l
-package-id=directory-1.3.0.2
-package-id=doctest-0.13.0-IN2h71ddd51KHWgAoJxdsY
-package-id=filepath-1.4.1.2
Servant.Swagger
Servant.Swagger.Test
Servant.Swagger.TypeLevel
Servant.Swagger.Internal
Servant.Swagger.Internal.Test
Servant.Swagger.Internal.TypeLevel
Servant.Swagger.Internal.TypeLevel.API
Servant.Swagger.Internal.TypeLevel.Every
Servant.Swagger.Internal.TypeLevel.TMap
Test suite doctests: FAIL
Test suite logged to: dist/test/servant-swagger-1.1.4-doctests.log
Test suite spec: RUNNING...
Test suite spec: PASS
Test suite logged to: dist/test/servant-swagger-1.1.4-spec.log
1 of 2 test suites (1 of 2 test cases) passed.

I see two problems there:
1st, there seems to be hardcoded max(int) and min(int) values, which obviously depend on the architecture.
2nd, the order is scrambled

replacing s/922337203685477580/214748364/ in src/Servant/Swagger.hs fixes the first issue, but the second one persists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions