Skip to content

Commit 6e96cdb

Browse files
authored
Integration: Run tests concurrently (#326)
1 parent d0383eb commit 6e96cdb

File tree

2 files changed

+151
-72
lines changed

2 files changed

+151
-72
lines changed

Sources/Integration/ContainerTests.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension IntegrationSuite {
2727
func testProcessTrue() async throws {
2828
let id = "test-process-true"
2929

30-
let bs = try await bootstrap()
30+
let bs = try await bootstrap(id)
3131
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
3232
config.process.arguments = ["/bin/true"]
3333
}
@@ -46,7 +46,7 @@ extension IntegrationSuite {
4646
func testProcessFalse() async throws {
4747
let id = "test-process-false"
4848

49-
let bs = try await bootstrap()
49+
let bs = try await bootstrap(id)
5050
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
5151
config.process.arguments = ["/bin/false"]
5252
}
@@ -91,7 +91,7 @@ extension IntegrationSuite {
9191

9292
func testProcessEchoHi() async throws {
9393
let id = "test-process-echo-hi"
94-
let bs = try await bootstrap()
94+
let bs = try await bootstrap(id)
9595

9696
let buffer = BufferWriter()
9797
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
@@ -123,7 +123,7 @@ extension IntegrationSuite {
123123
func testMultipleConcurrentProcesses() async throws {
124124
let id = "test-concurrent-processes"
125125

126-
let bs = try await bootstrap()
126+
let bs = try await bootstrap(id)
127127
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
128128
config.process.arguments = ["/bin/sleep", "1000"]
129129
}
@@ -165,7 +165,7 @@ extension IntegrationSuite {
165165

166166
func testMultipleConcurrentProcessesOutputStress() async throws {
167167
let id = "test-concurrent-processes-output-stress"
168-
let bs = try await bootstrap()
168+
let bs = try await bootstrap(id)
169169
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
170170
config.process.arguments = ["/bin/sleep", "1000"]
171171
}
@@ -234,7 +234,7 @@ extension IntegrationSuite {
234234
func testProcessUser() async throws {
235235
let id = "test-process-user"
236236

237-
let bs = try await bootstrap()
237+
let bs = try await bootstrap(id)
238238
var buffer = BufferWriter()
239239
var container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
240240
config.process.arguments = ["/usr/bin/id"]
@@ -327,7 +327,7 @@ extension IntegrationSuite {
327327
func testProcessTtyEnvvar() async throws {
328328
let id = "test-process-tty-envvar"
329329

330-
let bs = try await bootstrap()
330+
let bs = try await bootstrap(id)
331331
let buffer = BufferWriter()
332332
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
333333
config.process.arguments = ["env"]
@@ -361,7 +361,7 @@ extension IntegrationSuite {
361361
func testProcessHomeEnvvar() async throws {
362362
let id = "test-process-home-envvar"
363363

364-
let bs = try await bootstrap()
364+
let bs = try await bootstrap(id)
365365
let buffer = BufferWriter()
366366
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
367367
config.process.arguments = ["env"]
@@ -394,7 +394,7 @@ extension IntegrationSuite {
394394
func testProcessCustomHomeEnvvar() async throws {
395395
let id = "test-process-custom-home-envvar"
396396

397-
let bs = try await bootstrap()
397+
let bs = try await bootstrap(id)
398398
let customHomeEnvvar = "HOME=/tmp/custom/home"
399399
let buffer = BufferWriter()
400400
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
@@ -426,7 +426,7 @@ extension IntegrationSuite {
426426
func testHostname() async throws {
427427
let id = "test-container-hostname"
428428

429-
let bs = try await bootstrap()
429+
let bs = try await bootstrap(id)
430430
let buffer = BufferWriter()
431431
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
432432
config.process.arguments = ["/bin/hostname"]
@@ -454,7 +454,7 @@ extension IntegrationSuite {
454454
func testHostsFile() async throws {
455455
let id = "test-container-hosts-file"
456456

457-
let bs = try await bootstrap()
457+
let bs = try await bootstrap(id)
458458
let entry = Hosts.Entry.localHostIPV4(comment: "Testaroo")
459459
let buffer = BufferWriter()
460460
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
@@ -483,7 +483,7 @@ extension IntegrationSuite {
483483
func testProcessStdin() async throws {
484484
let id = "test-container-stdin"
485485

486-
let bs = try await bootstrap()
486+
let bs = try await bootstrap(id)
487487
let buffer = BufferWriter()
488488
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
489489
config.process.arguments = ["cat"]
@@ -511,7 +511,7 @@ extension IntegrationSuite {
511511
func testMounts() async throws {
512512
let id = "test-cat-mount"
513513

514-
let bs = try await bootstrap()
514+
let bs = try await bootstrap(id)
515515
let buffer = BufferWriter()
516516
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
517517
let directory = try createMountDirectory()
@@ -541,7 +541,7 @@ extension IntegrationSuite {
541541
func testPauseResume() async throws {
542542
let id = "test-pause-resume"
543543

544-
let bs = try await bootstrap()
544+
let bs = try await bootstrap(id)
545545
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
546546
config.process.arguments = ["sleep", "infinity"]
547547
}
@@ -562,7 +562,7 @@ extension IntegrationSuite {
562562
func testPauseResumeWait() async throws {
563563
let id = "test-pause-resume-wait"
564564

565-
let bs = try await bootstrap()
565+
let bs = try await bootstrap(id)
566566
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
567567
config.process.arguments = ["sleep", "2"]
568568
}
@@ -592,7 +592,7 @@ extension IntegrationSuite {
592592
func testPauseResumeIO() async throws {
593593
let id = "test-pause-resume-io"
594594

595-
let bs = try await bootstrap()
595+
let bs = try await bootstrap(id)
596596
let buffer = BufferWriter()
597597
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
598598
config.process.arguments = ["ping", "-c", "5", "localhost"]
@@ -626,7 +626,7 @@ extension IntegrationSuite {
626626
func testNestedVirtualizationEnabled() async throws {
627627
let id = "test-nested-virt"
628628

629-
let bs = try await bootstrap()
629+
let bs = try await bootstrap(id)
630630
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
631631
config.process.arguments = ["/bin/true"]
632632
config.virtualization = true
@@ -655,7 +655,7 @@ extension IntegrationSuite {
655655
let id = "test-container-manager"
656656

657657
// Get the kernel from bootstrap
658-
let bs = try await bootstrap()
658+
let bs = try await bootstrap(id)
659659

660660
// Create ContainerManager with kernel and initfs reference
661661
var manager = try ContainerManager(vmm: bs.vmm)
@@ -696,7 +696,7 @@ extension IntegrationSuite {
696696
let id = "test-container-stop-idempotency"
697697

698698
// Get the kernel from bootstrap
699-
let bs = try await bootstrap()
699+
let bs = try await bootstrap(id)
700700

701701
// Create ContainerManager with kernel and initfs reference
702702
var manager = try ContainerManager(vmm: bs.vmm)
@@ -739,7 +739,7 @@ extension IntegrationSuite {
739739
let id = "test-container-reuse"
740740

741741
// Get the kernel from bootstrap
742-
let bs = try await bootstrap()
742+
let bs = try await bootstrap(id)
743743

744744
// Create ContainerManager with kernel and initfs reference
745745
var manager = try ContainerManager(vmm: bs.vmm)
@@ -789,7 +789,7 @@ extension IntegrationSuite {
789789
func testContainerDevConsole() async throws {
790790
let id = "test-container-devconsole"
791791

792-
let bs = try await bootstrap()
792+
let bs = try await bootstrap(id)
793793

794794
var manager = try ContainerManager(vmm: bs.vmm)
795795
defer {
@@ -837,7 +837,7 @@ extension IntegrationSuite {
837837
func testContainerStatistics() async throws {
838838
let id = "test-container-statistics"
839839

840-
let bs = try await bootstrap()
840+
let bs = try await bootstrap(id)
841841
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
842842
config.process.arguments = ["sleep", "infinity"]
843843
}
@@ -880,7 +880,7 @@ extension IntegrationSuite {
880880
func testCgroupLimits() async throws {
881881
let id = "test-cgroup-limits"
882882

883-
let bs = try await bootstrap()
883+
let bs = try await bootstrap(id)
884884
let container = try LinuxContainer(id, rootfs: bs.rootfs, vmm: bs.vmm) { config in
885885
config.process.arguments = ["sleep", "infinity"]
886886
config.cpus = 2

0 commit comments

Comments
 (0)