Skip to content

Run unit tests that require root perms in CI#1875

Merged
sondavidb merged 2 commits into
awslabs:mainfrom
sondavidb:run-root-tests
Mar 30, 2026
Merged

Run unit tests that require root perms in CI#1875
sondavidb merged 2 commits into
awslabs:mainfrom
sondavidb:run-root-tests

Conversation

@sondavidb
Copy link
Copy Markdown
Contributor

@sondavidb sondavidb commented Feb 27, 2026

Issue #, if available:
Closes #892

Description of changes:
Added the necessary flags to the Makefile to pass -test.root to the testing binaries. We can't just use GO_TEST_ARGS as passing -test.root there will cause an unrecognized flag error in all of our other packages, as only the snapshot package uses the -test.root flag, so passing it to the test binary allows all the other tests to just ignore it.

Really I don't think we should be using containerd's testutil.RequiresRoot at all. But this is a decent bandaid fix.

This also added a separate commit to fix our failing remote tests as we did not have a namespace attached to the contexts passed in which would cause them to fail.

Testing performed:
GO_TEST_BINARY_FLAGS='-test.root' make test failed locally but seems like issues with my local setup. Opening as draft to see if runners will have the same issue. If not, will take out of draft state.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sondavidb sondavidb changed the title Run root tests Run unit tests that require root perms in CI Feb 27, 2026
Signed-off-by: David Son <davbson@amazon.com>
@sondavidb
Copy link
Copy Markdown
Contributor Author

sondavidb commented Feb 27, 2026

Been testing with go test ./snapshot -test.root with root perms.

Two issues here:

  1. It seems to not be happy with the permissions I'm adding to the Mount syscalls. That's annoying and I can't figure that out...
  2. The last known commit that I could get passing with these changes is ed7a741 all the way back in March 2023 😬 b64bf2f seems to be the breaking change, which is the containerd 1.7 upgrade.

What bothers me is that stargz runs this exact test but it does not fail. I attempted to run it locally and it did fail there as well. Wonder if there's some setup we're missing here...

In any case, it's an option to skip the test entirely if it's causing so much trouble. But I would like to figure it out if possible.

@sondavidb sondavidb force-pushed the run-root-tests branch 9 times, most recently from d6997ff to 06b4f83 Compare February 27, 2026 22:23
@sondavidb
Copy link
Copy Markdown
Contributor Author

sondavidb commented Feb 27, 2026

I found the culprit. Our CodeBuild runners are on 4.14 which is causing issues with mounting. Newest Ubuntu runners are using 6.14 which doesn't have these issues. We still have issues on CodeBuild with cross-device linking as well which I haven't figured out the reason for, but CI on regular GitHub Ubuntu runners seems to pass.

As a bandaid solution, I'll create a separate workflow that only runs root tests on an Ubuntu runner. I'll create an issue to track this as well.

Signed-off-by: David Son <davbson@amazon.com>
@sondavidb sondavidb marked this pull request as ready for review February 27, 2026 22:52
@sondavidb sondavidb requested a review from a team as a code owner February 27, 2026 22:52
Comment thread .github/workflows/build.yml
@sondavidb sondavidb merged commit 8f363ce into awslabs:main Mar 30, 2026
54 of 55 checks passed
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.

[Bug] Snapshotter unit tests which require root permissions are skipped in CI

3 participants