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

makefile: run containers/image unit tests #308

Closed
wants to merge 3 commits into from

Conversation

cyphar
Copy link
Contributor

@cyphar cyphar commented Feb 17, 2017

Because containers/image doesn't vendor anything, it has trouble running
its own tests (it depends on packages which may change in the future).
To make sure that containers/image is tested with our own vendored
packages, run its tests as part of our unit tests.

This isn't enabled globally for obvious reasons.

Signed-off-by: Aleksa Sarai [email protected]

@runcom
Copy link
Member

runcom commented Feb 17, 2017

👍 @mtrmac PTAL

@cyphar
Copy link
Contributor Author

cyphar commented Feb 17, 2017

Ah, dammit. vndr removes _test* files. I'll add a patch to vndr to fix this...

EDIT: Here's the patch: LK4D4/vndr#23.

Because containers/image doesn't vendor anything, it has trouble running
its own tests (it depends on packages which may change in the future).
To make sure that containers/image _is_ tested with our own vendored
packages, run its tests as part of our unit tests.

This isn't enabled globally for obvious reasons.

Signed-off-by: Aleksa Sarai <[email protected]>
@runcom
Copy link
Member

runcom commented Feb 17, 2017

EDIT: Here's the patch: LK4D4/vndr#23.

is this per vendored project or an all-or-nothing test files?

@cyphar
Copy link
Contributor Author

cyphar commented Feb 17, 2017

It's only done in the final stage of "cleaning". So if you only update one project at a time (which is what we do) then it will only "not clean" the project in question. If @LK4D4 wants, I can extend it so that it's a regexp for what projects to clean or not clean.

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Contributor Author

cyphar commented Feb 17, 2017

The extension is in LK4D4/vndr#24. So you would run vndr -whitelist "github\.com/containers/image/.*" to update everything but leave containers/image alone. You can also specify multiple whitelists.

@mtrmac
Copy link
Contributor

mtrmac commented Feb 21, 2017

Conceptually this seems strange to me; if we want to run containers/image unit tests against skopeo vendored packages to test a containers/image property (that containers/image works against those dependencies), why would that not be a part of the containers/image repo, the way test-skopeo is also inside the containers/image repo to test a containers/image property (that containers/image does not break skopeo without us knowing)?

Would we completely stop running unit tests in containers/image CI and hope that skopeo’s CI will eventually notice failures? That seems very unappealing.

Given the existing “clone skopeo” script in test-skopeo, that would be conceptually a trivial GOPATH=$skopeo_path/vendor:$GOPATH go test ./... (I’m sure that the actual code would be 2–5× trickier, but still much simpler than patching vndr and using a special process to revendor c/image in skopeo, and …)

@erikh
Copy link
Contributor

erikh commented Feb 27, 2017

Maybe an integration suite that lives in a third repo would be best?

@mtrmac
Copy link
Contributor

mtrmac commented Feb 27, 2017

With containers/image#240, we are now running containers/image tests against vendored dependencies, so the original motivation for this PR seems to no longer apply. @cyphar , can this be closed?

Maybe an integration suite that lives in a third repo would be best?

What value would the independent repo bring? If we wanted to run containers/image tests against the skopeo vendored dependencies¹, we could copy them equally easily from the containers/image repo and from a third independent repo.

¹ OTOH we’ve been toying with the idea of having an independent repo carrying vendor.conf which would be shared between containers/image and skopeo; then the re-run of tests would be obviously redundant.

Either way, splitting stuff across repositories makes CI more complex—when changing a dependency, we would like to make a CI run of all the users of that dependency as well (like we are doing by make test-skopeo in containers/image). So, the more repos, the more cross-repo CI infrastructure, longer edit loops… and in the end we would want to update most of the repos in lockstep pretty much all of the time.

Or am I missing something essential about a separate test-only repo?

@erikh
Copy link
Contributor

erikh commented Feb 27, 2017 via email

@rhatdan
Copy link
Member

rhatdan commented Aug 14, 2017

Is this pull request still something we are considering?

@mtrmac
Copy link
Contributor

mtrmac commented Aug 22, 2017

It still seems to me that doing this in the containers/image repo, as a part of an extension to the existing make test-skopeo, would be much simpler—if this is still needed after containers/image#240 .

@cyphar
Copy link
Contributor Author

cyphar commented Aug 23, 2017

The problem is that containers/image doesn't vendor anything, so it can't run any of the tests. The reason for that is because Go's nested vendoring is broken-by-design.

@mtrmac
Copy link
Contributor

mtrmac commented Aug 23, 2017

I’m not sure I understand:

  • containers/image itself does not vendor dependencies in the repo, but for the purpose of running tests it does vendor in the dependencies: https://github.com/containers/image/blob/master/Makefile#L30
  • skopeo does vendor dependencies in the repo, so the make test-skopeo command in containers/image can check out skopeo including the dependencies, and it seems to me that it could also use skopeo’s vendor tree as $GOPATH (±some symlinks, I guess) to run the containers/image tests. Am I overlooking something which would make this impossible?

@rhatdan
Copy link
Member

rhatdan commented Mar 8, 2018

@cyphar This needs a rebase or needs to be closed.

@rhatdan
Copy link
Member

rhatdan commented Sep 21, 2018

@cyphar Still waiting to see if I should close. Will close in one week.

@cyphar
Copy link
Contributor Author

cyphar commented Sep 25, 2018

I'm going to close this since it's not really progressed much. I agree with @erikh that the project testing needs to be restructured (in the past skopeo had some growing pains that were only detected because of umoci's test suite -- and my hope with this was that we could avoid this issue by testing containers/image properly) but am not sure how it should look.

@cyphar cyphar closed this Sep 25, 2018
@cyphar cyphar deleted the test-vendors branch September 25, 2018 06:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants