Skip to content

Commit

Permalink
pillar: Add verifier uint test for filename without MediaType.
Browse files Browse the repository at this point in the history
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: lf-edge#3704

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
(cherry picked from commit 25db0d8)
  • Loading branch information
OhmSpectator authored and eriknordmark committed Jan 25, 2024
1 parent 921b9fd commit 4972221
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/pillar/cmd/verifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

}

0 comments on commit 4972221

Please sign in to comment.