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 tests cases for malformed and conflicting patches #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bchuo
Copy link
Contributor

@bchuo bchuo commented Feb 11, 2025

What this PR does / why we need it: We need to test to ensure we fail when a patch is either malformed or conflicts with another patch.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #500

Special notes for your reviewer:

@bchuo bchuo requested a review from a team as a code owner February 11, 2025 22:05
func TestPatchSource_MalformedPatch(t *testing.T) {
worker := llb.Scratch()
sourceState := llb.Scratch().File(
llb.Mkfile("/file.txt", 0644, []byte("Hello World")),
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the updated octal format 0o644 for everything?

},
}

assert.Assert(t, func() {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this is testing that the closure is not nil which doesn't look correct.

I think the easiest way to test these is in the integration tests (under test/) where we can get it to actually run the patch and produce an error.

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.

Add test case to ensure conflicting patches cause an error
2 participants