Skip to content

Commit

Permalink
Refactor how the hypervisor is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-carlborg committed Jul 23, 2023
1 parent 61b3a55 commit b119483
Show file tree
Hide file tree
Showing 21 changed files with 211 additions and 178 deletions.
138 changes: 67 additions & 71 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions spec/operating_systems/freebsd/freebsd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ describe('FreeBSD OperatingSystem', () => {

let host = new MockHost()
let osKind = os.Kind.for('freebsd')
let architecture = arch.Architecture.for(arch.Kind.x86_64, host, osKind)
let vmm = host.hypervisor
let freebsd = new FreeBsd(architecture, '0.0.0', vmm)
let architecture = arch.Architecture.for(arch.Kind.x86_64, host, osKind, vmm)
let freebsd = new FreeBsd(architecture, '0.0.0')
let hypervisorDirectory = 'hypervisor/directory'
let resourcesDirectory = 'resources/directory'
let firmwareDirectory = 'firmware/directory'
Expand Down Expand Up @@ -95,7 +95,13 @@ describe('FreeBSD OperatingSystem', () => {

describe('when the given hypervisor is Xhyve', () => {
it('creates a virtual machine using the Xhyve hypervisor', () => {
let freebsd = new FreeBsd(architecture, '0.0.0', new hypervisor.Xhyve())
let archObject = arch.Architecture.for(
arch.Kind.x86_64,
host,
osKind,
new hypervisor.Xhyve()
)
let freebsd = new FreeBsd(archObject, '0.0.0')
const vm = freebsd.createVirtualMachine(
hypervisorDirectory,
resourcesDirectory,
Expand All @@ -110,7 +116,13 @@ describe('FreeBSD OperatingSystem', () => {

describe('when the given hypervisor is Qemu', () => {
it('creates a virtual machine using the Qemu hypervisor', () => {
let freebsd = new FreeBsd(architecture, '0.0.0', new hypervisor.Qemu())
let archObject = arch.Architecture.for(
arch.Kind.x86_64,
host,
osKind,
new hypervisor.Qemu()
)
let freebsd = new FreeBsd(archObject, '0.0.0')
const vm = freebsd.createVirtualMachine(
hypervisorDirectory,
resourcesDirectory,
Expand Down
7 changes: 6 additions & 1 deletion spec/operating_systems/freebsd/qemu_vm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ describe('FreeBSD QemuVm', () => {
let ssHostPort = 1234

let osKind = os.Kind.for('freebsd')
let architecture = arch.Architecture.for(arch.Kind.x86_64, host, osKind)
let architecture = arch.Architecture.for(
arch.Kind.x86_64,
host,
osKind,
host.hypervisor
)
let config = {
memory: memory,
cpuCount: cpuCount,
Expand Down
Loading

0 comments on commit b119483

Please sign in to comment.