Skip to content

refactor: split a testing library#625

Merged
brprice merged 1 commit intomainfrom
brprice/split-test-library
Aug 16, 2022
Merged

refactor: split a testing library#625
brprice merged 1 commit intomainfrom
brprice/split-test-library

Conversation

@brprice
Copy link
Copy Markdown
Contributor

@brprice brprice commented Aug 9, 2022

We split hedgehog generators, and some tasty glue into its own library
(as part of the Primer package). We split these out to enable reuse of
generators between primer and primer-service in the future. Note that
whilst internal libraries are supported with cabal-version: 2.4, the
ability to set visibility is only available from 3.0.

@brprice brprice requested a review from a team August 9, 2022 11:46
@brprice
Copy link
Copy Markdown
Contributor Author

brprice commented Aug 9, 2022

Notes for reviewers:

We have discussed doing something like this a while ago. I am now doing it so I can use generators in primer-service to test openapi descriptions vs json serialisations (I'll open a new pr for that shortly).

This PR is only moving code around, and I suspect is more bikeshed-able than the actual testing PR -- I am happy to have suggestions on better module/file organisation etc!

@brprice
Copy link
Copy Markdown
Contributor Author

brprice commented Aug 9, 2022

@dhess I don't think any nix changes are needed as haskell.nix should take care of everything, but could you confirm?

@dhess
Copy link
Copy Markdown
Member

dhess commented Aug 9, 2022

@dhess I don't think any nix changes are needed as haskell.nix should take care of everything, but could you confirm?

I don't see anything in here that would require Nix changes, no.

Copy link
Copy Markdown
Member

@dhess dhess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been wanting this for awhile, thanks!

Comment thread primer/primer.cabal
@brprice brprice force-pushed the brprice/split-test-library branch from dc0ce93 to e28b192 Compare August 9, 2022 14:24
@brprice brprice force-pushed the brprice/split-test-library branch 4 times, most recently from 4162911 to 8ef0fb1 Compare August 11, 2022 16:25
@brprice
Copy link
Copy Markdown
Contributor Author

brprice commented Aug 11, 2022

This is rebased and ready to go, except:

Locally, when building cabal clean ; cabal build -O0 primer-hedgehog (but not -O1), I am seeing the following in my terminal /nix/store/f0rrfmf8kh5bsiql5bbq7m4h3xgihpnx-binutils-2.38/bin/ld: warning: type and size of dynamic symbol `primerzm0zi7zi2zi0zminplace_PrimerziApp_defaultLog_closure' are not defined. I do not see this in CI though, or running nix build -v -L .#packages.x86_64-linux.primer:lib:primer-hedgehog. Does anyone have any idea why this happens, or if it is problematic?

We split hedgehog generators, and some tasty glue into its own library
(as part of the Primer package).  We split these out to enable reuse of
generators between primer and primer-service in the future.  Note that
whilst internal libraries are supported with cabal-version: 2.4, the
ability to set visibility is only available from 3.0.
@brprice brprice force-pushed the brprice/split-test-library branch from 8ef0fb1 to 0492962 Compare August 12, 2022 11:45
@brprice
Copy link
Copy Markdown
Contributor Author

brprice commented Aug 13, 2022

/nix/store/f0rrfmf8kh5bsiql5bbq7m4h3xgihpnx-binutils-2.38/bin/ld: warning: type and size of dynamic symbol `primerzm0zi7zi2zi0zminplace_PrimerziApp_defaultLog_closure' are not defined

This seems to be a haskell.nix devShell + cabal issue: I only see it in a haskell.nix devShell and cannot reproduce with a nixos ghc+cabal. The upstream issue seems to be input-output-hk/haskell.nix#662

@brprice brprice added this pull request to the merge queue Aug 16, 2022
Merged via the queue into main with commit e4a6910 Aug 16, 2022
@brprice brprice deleted the brprice/split-test-library branch August 16, 2022 14:33
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

Successfully merging this pull request may close these issues.

3 participants