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

test: make root tests easier to run #501

Merged

Conversation

IronCore864
Copy link
Contributor

@IronCore864 IronCore864 commented Sep 22, 2024

Background: Previously, when adding a new root test, we had to modify the GitHub Actions workflow to include the newly added test, which is some extra operational overhead.

Per discussion here, we agreed to run all tests with root and skip those tests that would fail with root (checking permissions and stuff), and this PR skips tests that would fail when running with root and made the GitHub Actions workflow for root tests much easier.

@IronCore864 IronCore864 changed the title [WIP] test: make root tests easier to run test: make root tests easier to run Sep 22, 2024
@IronCore864 IronCore864 marked this pull request as ready for review September 22, 2024 10:57
Copy link
Contributor

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Thanks for this, looks very simple. Just two minor tweaks requested.

internals/cli/cmd_add_test.go Outdated Show resolved Hide resolved
internals/osutil/io_test.go Outdated Show resolved Hide resolved
}
}

args = append(args, "extra", "arguments", "invalid")
_, err = cli.ParserForTest().ParseArgs(args)
c.Assert(err, check.Equals, cli.ErrExtraArgs)
s.ResetStdStreams()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test case uses a for loop to test combine=false and combine=true.

When running as root, adding the unreadableLayer would succeed and the stdout interferes with the next loop. So, here I added a reset on the stdout so that the two cases don't interfere with each other.

@IronCore864
Copy link
Contributor Author

Root tests passed.

Copy link
Contributor

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Great, thanks -- looks good to me!

@IronCore864 IronCore864 merged commit 3fce9ec into canonical:master Sep 23, 2024
17 checks passed
@IronCore864 IronCore864 deleted the make-root-tests-easier-to-run branch September 23, 2024 04:59
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.

2 participants