From 497222199185ea14b39b2c33173b3e6a7b719234 Mon Sep 17 00:00:00 2001 From: Nikolay Martyanov Date: Mon, 22 Jan 2024 20:23:11 +0100 Subject: [PATCH] pillar: Add verifier uint test for filename without MediaType. Introduces a new test in verifier_test.go to handle filenames without a media type, as might be generated by older EVE versions. Ensures correct processing of such filenames by the `verifyImageStatusFromVerifiedImageFile` function. Issue: #3704 Signed-off-by: Nikolay Martyanov (cherry picked from commit 25db0d86a50b8665cb2a2127ee48a106cdfc0c2f) --- pkg/pillar/cmd/verifier/verifier_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/pillar/cmd/verifier/verifier_test.go b/pkg/pillar/cmd/verifier/verifier_test.go index 2e2eab87cd..e8427194a6 100644 --- a/pkg/pillar/cmd/verifier/verifier_test.go +++ b/pkg/pillar/cmd/verifier/verifier_test.go @@ -28,3 +28,17 @@ func TestMediaTypeInStatusFromVerifiedFilename(t *testing.T) { t.Errorf("MediaType in status %v does not match original %v", status.MediaType, mediaType) } } + +func TestMediaTypeInStatusFromVerifiedFilenameWithNoMediaType(t *testing.T) { + log = base.NewSourceLogObject(logrus.StandardLogger(), "verifier_test", 0) + dummyPath := "dummyPath" + dummyFilename := "someSha256" + verifiedFilename := path.Join(dummyPath, dummyFilename) + + status := verifyImageStatusFromVerifiedImageFile(verifiedFilename, 12345, "dummyPath") + + if status != nil { + t.Errorf("Status is not nil") + } + +}