Skip to content

Commit 9e239fb

Browse files
authored
Fix 'TestOutputAndInjectArtifacts' test. (#370)
1. Skip this test on Azure Linux 2.0, since the systemd-boot package isn't available. 2. Increase the size of the ESP partition so that it can fit the UKIs. 3. Fix the expected paths of the injected file. 4. For the functional tests, set Azure Linux 3.0 as the default image instead of 2.0.
1 parent 722afea commit 9e239fb

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

toolkit/tools/pkg/imagecustomizerlib/artifactsinputoutput_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import (
1313
)
1414

1515
func TestOutputAndInjectArtifacts(t *testing.T) {
16-
baseImage, _ := checkSkipForCustomizeDefaultImage(t)
16+
baseImage, baseImageInfo := checkSkipForCustomizeDefaultImage(t)
17+
if baseImageInfo.Version == baseImageVersionAzl2 {
18+
t.Skip("'systemd-boot' is not available on Azure Linux 2.0")
19+
}
1720

1821
ukifyExists, err := file.CommandExists("ukify")
1922
assert.NoError(t, err)
@@ -152,20 +155,20 @@ func TestOutputAndInjectArtifacts(t *testing.T) {
152155

153156
// Check the injected files
154157
// shim
155-
expectedInjectedShim := filepath.Join(imageConnection.Chroot().RootDir(), "EFI", "BOOT", filepath.Base(bootBinary))
158+
expectedInjectedShim := filepath.Join(imageConnection.Chroot().RootDir(), "boot/efi/EFI/BOOT", filepath.Base(bootBinary))
156159
contains, err := fileContainsMarker(expectedInjectedShim, marker)
157160
assert.NoError(t, err)
158161
assert.True(t, contains, "Expected injected shim to exist:\n%s", expectedInjectedShim)
159162

160163
// systemd-boot
161-
expectedInjectedSystemdBoot := filepath.Join(imageConnection.Chroot().RootDir(), "EFI", "systemd", filepath.Base(systemdBootBinary))
164+
expectedInjectedSystemdBoot := filepath.Join(imageConnection.Chroot().RootDir(), "boot/efi/EFI/systemd", filepath.Base(systemdBootBinary))
162165
contains, err = fileContainsMarker(expectedInjectedSystemdBoot, marker)
163166
assert.NoError(t, err)
164167
assert.True(t, contains, "Expected injected systemd-boot to exist:\n%s", expectedInjectedSystemdBoot)
165168

166169
// UKI(s)
167170
for _, src := range ukiFiles {
168-
expectedInjectedUKI := filepath.Join(imageConnection.Chroot().RootDir(), "EFI", "Linux", filepath.Base(src))
171+
expectedInjectedUKI := filepath.Join(imageConnection.Chroot().RootDir(), "boot/efi/EFI/Linux", filepath.Base(src))
169172

170173
exists, err = file.PathExists(expectedInjectedUKI)
171174
assert.NoError(t, err)

toolkit/tools/pkg/imagecustomizerlib/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ var (
7979
}
8080

8181
defaultBaseImagePriorityList = []testBaseImageInfo{
82-
testBaseImageAzl2CoreEfi,
83-
testBaseImageAzl2BareMetal,
8482
testBaseImageAzl3CoreEfi,
8583
testBaseImageAzl3BareMetal,
84+
testBaseImageAzl2CoreEfi,
85+
testBaseImageAzl2BareMetal,
8686
}
8787
)
8888

toolkit/tools/pkg/imagecustomizerlib/testdata/artifacts-output.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
storage:
22
disks:
33
- partitionTableType: gpt
4-
maxSize: 2048M
54
partitions:
65
- id: esp
76
type: esp
8-
start: 1M
9-
end: 9M
7+
size: 100M
108

119
- id: boot
12-
start: 9M
13-
end: 108M
10+
size: 100M
1411

1512
- id: rootfs
16-
start: 108M
13+
size: 2G
1714

1815
bootType: efi
1916

0 commit comments

Comments
 (0)