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

Force evaluation before test execution #404

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Oct 16, 2024

This makes it so error messages from the build are not wrapped in error messages for tests.

Before this change the build is performed lazily until the point when the tests try to interact with the rootfs under test making it appear like a build failure is a test error when in reality we didn't even get to the test.

Closes #400

@cpuguy83 cpuguy83 requested a review from a team as a code owner October 16, 2024 00:14
@cpuguy83 cpuguy83 added this to the v0.10.0 milestone Oct 16, 2024
@cpuguy83 cpuguy83 requested a review from DannyBrito October 16, 2024 00:15
This makes it so error messages from the build are not wrapped in
error messages for tests.

Before this change the build is performed lazily until the point  when
the tests try to interact with the rootfs under test making it appear
like a build failure is a test error when in reality we didn't even get
to the test.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@@ -41,6 +41,14 @@ func RunTests(ctx context.Context, client gwclient.Client, spec *dalec.Spec, ref
return nil
}

if err := ref.Evaluate(ctx); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're already doing ref.Evaluate after we create package build state for deb/rpm, really the only extra errors this will surface here would be install errors from installing the package in the target container, correct? That should in general be the only extra state that hasn't yet been solved at this point?

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, the package build state is only evaluated on the packaging build targets, not the container targets.
But other than that, yes you are correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah got it, the build state hasn't yet been evaluated if we've reached this code path from a container target. And in the case of packaging build targets, this ref.Evaluate would actually surface errors from installing in the test container, not the target container since there is no target container in that case. Thanks for clarifying

Copy link
Contributor

@adamperlin adamperlin left a comment

Choose a reason for hiding this comment

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

I think this LGTM!

@cpuguy83 cpuguy83 merged commit 0c0e338 into Azure:main Oct 18, 2024
9 checks passed
@cpuguy83 cpuguy83 deleted the eval_before_tests branch October 18, 2024 21:47
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.

Force the state to be evaluated before running package tests
2 participants