Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdatableIndexSetting' JSON isomorphism test failure #233

Open
bitemyapp opened this issue Apr 7, 2018 · 1 comment
Open

UpdatableIndexSetting' JSON isomorphism test failure #233

bitemyapp opened this issue Apr 7, 2018 · 1 comment

Comments

@bitemyapp
Copy link
Owner

instance Arbitrary UpdatableIndexSetting' where
  arbitrary = do
    settings <- arbitrary
    return $ UpdatableIndexSetting' $ case settings of
      RoutingAllocationInclude xs ->
        RoutingAllocationInclude (dropDuplicateAttrNames xs)
      RoutingAllocationExclude xs ->
        RoutingAllocationExclude (dropDuplicateAttrNames xs)
      RoutingAllocationRequire xs ->
        RoutingAllocationRequire (dropDuplicateAttrNames xs)
      x -> x
    where
      dropDuplicateAttrNames =
        NE.fromList . L.nubBy sameAttrName . NE.toList
      sameAttrName a b =
        nodeAttrFilterName a == nodeAttrFilterName b
  shrink (UpdatableIndexSetting' x) = map UpdatableIndexSetting' (shrink x)

Currently failing in master. Any suggestions? @MichaelXavier

@MichaelXavier
Copy link
Collaborator

What does the failure say? Most of the time JSON isomorphisms fail due to either invariants that don't get enforced at the type level (e.g. duplicate keys) or type ambiguities, e.g. Maybe [a] where Nothing and [] get represented the same in the JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants