Repository navigation
fix: avoid errors when --max-package-size differs between create runs - #3398
Conversation
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
✅ Deploy Preview for zarf-docs canceled.
|
Codecov ReportAttention: Patch coverage is
|
--max-package-size differs between runs--max-package-size differs between create runs
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
| func TestSplitFile(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| tests := []struct { |
| t.Run(tt.name, func(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| dir := t.TempDir() |
There was a problem hiding this comment.
Nonblocking: this is more of a style thing, but usually I add some small intent comment (example below) on a series of logically similar operations. There's tradeoffs here with just making self-documenting code, so I'm curious where your opinions are at there.
There was a problem hiding this comment.
I think it's a reasonable thing to do. I try to break up my tests with indentation and the arrange-act-assert methodology. I don't think comments are always necessary, but when code is non intuitive I do think it helps to provide additional context.
In this case, this test case was actually from packager1 so I just copied it over, going forward I'll try to air on the side of more clarity.
| err = splitFile(context.Background(), p, tt.chunkSize) | ||
| require.NoError(t, err) | ||
|
|
||
| _, err = os.Stat(p) |
There was a problem hiding this comment.
e.g.
// Ensure content exists
| data := make([]byte, 50) | ||
| err := os.WriteFile(inputFilename, data, 0644) | ||
| require.NoError(t, err) | ||
| // Create many fake split files |
…ns (zarf-dev#3398) Signed-off-by: Austin Abro <AustinAbro321@gmail.com> Signed-off-by: NevinAragam <nevin.aragam@gmail.com>
Description
As seen explained in #3266 the existing split file logic doesn't replace files it writes over leading to errors with create is run with different
--max-package-sizevalues. Additionally, if the package is split and there are more files than Zarf is expecting (likely leftovers from a previous run) Zarf will give the below errorERROR: failed to deploy package: unable to load the package: package is missing parts, expected 15, found 29Related Issue
Fixes #3266
Checklist before merging