Skip to content

Commit

Permalink
Adjust another test for the latest snapd changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sil2100 committed Aug 18, 2023
1 parent bac2eff commit 53b1542
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/statemachine/state_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ func TestPostProcessGadgetYaml(t *testing.T) {
VolumeName: "pc",
Type: "0C",
Offset: createOffsetPointer(1048576),
MinSize: 536870912,
Size: 536870912,
Label: "system-boot",
Filesystem: "vfat",
Expand Down Expand Up @@ -644,6 +645,7 @@ func TestPostProcessGadgetYaml(t *testing.T) {
Type: "mbr",
Offset: createOffsetPointer(0),
Role: "mbr",
MinSize: 440,
Size: 440,
Content: []gadget.VolumeContent{
{
Expand All @@ -656,6 +658,7 @@ func TestPostProcessGadgetYaml(t *testing.T) {
VolumeName: "pc",
Name: "BIOS Boot",
Type: "DA,21686148-6449-6E6F-744E-656564454649",
MinSize: 1048576,
Size: 1048576,
OffsetWrite: &gadget.RelativeOffset{
RelativeTo: "mbr",
Expand All @@ -673,6 +676,7 @@ func TestPostProcessGadgetYaml(t *testing.T) {
VolumeName: "pc",
Name: "EFI System",
Type: "EF,C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
MinSize: 52428800,
Size: 52428800,
Filesystem: "vfat",
Offset: createOffsetPointer(2097152),
Expand Down Expand Up @@ -723,6 +727,13 @@ func TestPostProcessGadgetYaml(t *testing.T) {
err = stateMachine.loadGadgetYaml()
asserter.AssertErrNil(err, false)

// we now need to also ensure the expectedResult to have properly set volume pointers
for i := range tc.expectedResult.Structure {
if tc.expectedResult.Structure[i].VolumeName != "" {
tc.expectedResult.Structure[i].EnclosingVolume = stateMachine.GadgetInfo.Volumes[tc.expectedResult.Structure[i].VolumeName]
}
}

if !reflect.DeepEqual(*stateMachine.GadgetInfo.Volumes["pc"], tc.expectedResult) {
t.Errorf("GadgetInfo after postProcessGadgetYaml:\n%+v "+
"does not match expected result:\n%+v",
Expand Down

0 comments on commit 53b1542

Please sign in to comment.