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

Provide handy mocks and testing utilities #53

Open
samj1912 opened this issue Apr 14, 2021 · 2 comments
Open

Provide handy mocks and testing utilities #53

samj1912 opened this issue Apr 14, 2021 · 2 comments
Labels
type:enhancement A general enhancement
Milestone

Comments

@samj1912
Copy link
Member

samj1912 commented Apr 14, 2021

Currently almost every buildpack that uses libcnb and has tests has to write code to create mock contexts etc. We should consider adding this to the existing set of mocks.

We should also consider adding utilities for integration testing buildpacks (possibly in a separate library) that possibly uses pack and docker. Example of something like this https://github.com/paketo-buildpacks/occam

@dmikusa
Copy link
Contributor

dmikusa commented Oct 3, 2023

I'm going to split the second part of this into a separate issue. See #259.

I'd like to see this for v2, and I have some ideas.

In Paketo tests, we frequently need to create some part of the context & layers by making temp directories. It would be nice to have some convenient API to build that for tests. It'll be more of a stub than a mock, but I think it could be beneficial & reduce test code.

We've also used Gomega in testing for libcnb. I think it might be helpful to add some Gomega matchers for common assertions. This could reduce code in tests as well.

That's off the top of my head. I'm going to look through Paketo buildpacks more and see what else jumps out as possibilities for reducing boiler plate code in tests.

@samj1912 Let me know if you had other ideas in mind here too. Thanks

@dmikusa dmikusa added the type:enhancement A general enhancement label Oct 3, 2023
@dmikusa dmikusa added this to the 2.0 milestone Oct 3, 2023
@loewenstein
Copy link

@dmikusa is this in the 2.0 milestone because it cannot be done in 1.x or because it is a requirement to release 2.0?

cc @samj1912

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

No branches or pull requests

3 participants