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

Add an integration test that verifies changes to whitelisted dirs aren't snapshotted #307

Closed
bobcatfish opened this issue Aug 24, 2018 · 1 comment
Labels
area/testing Issues related to testing kaniko itself good first issue Good for newcomers

Comments

@bobcatfish
Copy link
Contributor

Changes to whitelisted dirs such as /kaniko shouldn't be captured in the layers created by kaniko. We previously had some coverage for the functionality in snapshot_test.go, but since that test creates a temporary directory to work in, we had to make the whitelist aware of the test dir (i.e. we complicated the white list logic just to make the test work). Instead we have removed the complication, but the result is that our only test coverage for whitelisting is in fs_util_test.go.

It would be nice to add an integration test that definitely makes a change to /kaniko and verifies the change isn't snapshotted (alternatively, prove that our existing tests already cover this!).

@bobcatfish bobcatfish added the good first issue Good for newcomers label Aug 24, 2018
bobcatfish added a commit to bobcatfish/kaniko that referenced this issue Aug 24, 2018
This test had previously (before GoogleContainerTools#231) been making a change to a file in
the kaniko dir, then checking that it isn't being snapshotted. This was
to test the whitelisting logic, which makes sure that changes to /kaniko
aren't included in images. However the test creates a temporary dir, so
the kaniko dir is actually in /tmp/<some temp dir>/kaniko, and
in GoogleContainerTools#231 the logic was simplified to no longer have a special case for
tests. The test continued to pass because `MaybeAdd` noticed that the
kaniko file wasn't changing, and didn't add it. After changing this to
always add the files, it revealed that this was left behind by accident.

I also opened GoogleContainerTools#307 to add integration test coverage for this logic.

I also marked `CheckErrorAndDeepEqual` as a helper function so that when
it fails, the line number reported is where that was called.
@priyawadhwa priyawadhwa added the area/testing Issues related to testing kaniko itself label Aug 27, 2018
@bobcatfish
Copy link
Contributor Author

We have this covered in unit tests, gonna assume this is good! Turns out that integration tests are a scam :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Issues related to testing kaniko itself good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants