Skip to content

Commit

Permalink
adjusiting tests for checksumType empty case
Browse files Browse the repository at this point in the history
  • Loading branch information
fracappa committed Jan 9, 2025
1 parent 2f613a0 commit 103a48e
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions apis/metal3.io/v1alpha1/baremetalhost_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,21 +338,53 @@ func TestGetImageChecksum(t *testing.T) {
ExpectedType: "md5",
},
{
Scenario: "checksum value specified but not type",
Scenario: "checksum value specified but not type and checksum is md5",
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
Spec: BareMetalHostSpec{
Image: &Image{
Checksum: "md5hash",
Checksum: "d41d8cd98f00b204e9800998ecf8427e",
},
},
},
Expected: true,
ExpectedType: "md5",
},
{
Scenario: "checksum value specified but not type and checksum is sha256",
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
Spec: BareMetalHostSpec{
Image: &Image{
Checksum: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
},
},
},
Expected: true,
ExpectedType: "sha256",
},
{
Scenario: "checksum value specified but not type and checksum is sha512",
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
Spec: BareMetalHostSpec{
Image: &Image{
Checksum: "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", // 128-char SHA512 checksum
},
},
},
Expected: true,
ExpectedType: "sha512",
},
{
Scenario: "checksum value specified, auto type",
Host: BareMetalHost{
Expand Down

0 comments on commit 103a48e

Please sign in to comment.