Skip to content

Commit 12eb224

Browse files
committed
test(patch): tighten single.go unit coverage
Replace overlapping package-type tests in single_test.go with focused single-arch coverage and move the unique parsePkgTypes edge cases into patch_validation_test.go. Strengthen loader error assertions, add setupWorkingFolder failure coverage, and cover report parsing plus no-updates guardrails before BuildKit is involved. Coverage achieved on single.go: 67.4%. New test functions: - TestSetupWorkingFolderReturnsTempDirCreationError - TestSetupWorkingFolderReturnsEnsurePathErrors - TestPatchSingleArchImageReturnsReportParseError - TestPatchSingleArchImageReturnsNoUpdatesFoundAfterFiltering Strengthened test: - TestLoadImageToRuntimeReturnsLoaderCreationErrors now verifies io.PipeReader CloseWithError propagation No production code changed. Signed-off-by: Omer <omer@descope.com>
1 parent ae878ee commit 12eb224

2 files changed

Lines changed: 411 additions & 0 deletions

File tree

pkg/patch/patch_validation_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,24 @@ func TestParsePkgTypes(t *testing.T) {
108108
expected: []string{utils.PkgTypeOS, utils.PkgTypeLibrary},
109109
expectError: false,
110110
},
111+
{
112+
name: "duplicates are preserved in order",
113+
input: "library,library,os",
114+
expected: []string{utils.PkgTypeLibrary, utils.PkgTypeLibrary, utils.PkgTypeOS},
115+
expectError: false,
116+
},
111117
{
112118
name: "invalid type",
113119
input: "invalid",
114120
expected: nil,
115121
expectError: true,
116122
},
123+
{
124+
name: "blank entry is rejected",
125+
input: "os,,library",
126+
expected: nil,
127+
expectError: true,
128+
},
117129
{
118130
name: "mixed valid and invalid types",
119131
input: "os,invalid",

0 commit comments

Comments
 (0)