Skip to content

Commit 5d00a00

Browse files
committed
Fix failing withDefaultPackagesAndCommandsEncodesCorrectly test
1 parent a3ecc28 commit 5d00a00

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Tests/VMTests/ConfigurationTests.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,22 @@ struct CloudInitConfigurationTests {
8888
// Verify packages include qemu-guest-agent (checkpolicy installed conditionally)
8989
#expect(userData["packages"] as? [String] == ["qemu-guest-agent"])
9090

91-
// Verify runcmd includes conditional SELinux policy setup and service enable
91+
// Verify runcmd includes conditional SELinux policy setup, service enable, and mount
9292
let runcmd = userData["runcmd"] as? [String]
93-
#expect(runcmd?.count == 2)
93+
#expect(runcmd?.count == 3)
9494
// First command handles SELinux conditionally
9595
#expect(runcmd?[0].contains("semodule") == true)
9696
#expect(runcmd?[0].contains("checkmodule") == true)
97-
// Second command handles service startup (systemd or OpenRC)
97+
// Second command handles service startup with systemd
9898
#expect(runcmd?[1].contains("systemctl") == true)
99-
#expect(runcmd?[1].contains("rc-update") == true)
99+
#expect(runcmd?[1].contains("daemon-reload") == true)
100+
// Third command creates mount point and mounts
101+
#expect(runcmd?[2].contains("mkdir -p") == true)
102+
#expect(runcmd?[2].contains("mount -a") == true)
100103

101104
// Verify write_files array (snake_case key)
102105
let writeFiles = userData["write_files"] as! [[String: Any]]
103-
#expect(writeFiles.count == 2)
106+
#expect(writeFiles.count == 3)
104107

105108
// Find SELinux policy file
106109
let selinuxFile = writeFiles.first { $0["path"] as? String == "/etc/selinux/qemu-vsock.te" }
@@ -130,5 +133,12 @@ struct CloudInitConfigurationTests {
130133
[Install]
131134
WantedBy=multi-user.target
132135
""")
136+
137+
// Find fstab entry file
138+
let fstabFile = writeFiles.first { $0["path"] as? String == "/etc/fstab" }
139+
#expect(fstabFile != nil)
140+
#expect((fstabFile?["content"] as? String)?.contains("hostHome") == true)
141+
#expect((fstabFile?["content"] as? String)?.contains("virtiofs") == true)
142+
#expect(fstabFile?["append"] as? Bool == true)
133143
}
134144
}

0 commit comments

Comments
 (0)