-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for configuring memory of the VM and also increases the default memory.
- Loading branch information
1 parent
3042801
commit 638446b
Showing
11 changed files
with
156 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import FreeBsd from '../../../src/operating_systems/freebsd/freebsd' | ||
import {host} from '../../../src/host' | ||
import * as arch from '../../../src/architecture' | ||
import * as os from '../../../src/operating_systems/kind' | ||
|
||
describe('FreeBSD OperatingSystem', () => { | ||
let osKind = os.Kind.for('freebsd') | ||
let architecture = arch.Architecture.for(arch.Kind.x86_64, host, osKind) | ||
let freebsd = new FreeBsd(architecture, '0.0.0') | ||
let hypervisorDirectory = 'hypervisor/directory' | ||
let resourcesDirectory = 'resources/directory' | ||
let firmwareDirectory = 'firmware/directory' | ||
|
||
let config = { | ||
memory: '4G', | ||
cpuCount: 0, | ||
diskImage: '', | ||
resourcesDiskImage: '', | ||
userboot: '' | ||
} | ||
|
||
describe('createVirtualMachine', () => { | ||
let vmModule = jasmine.createSpy('vmModule') | ||
|
||
beforeEach(() => { | ||
spyOn(host.vmModule, 'resolve').and.returnValue(vmModule) | ||
}) | ||
|
||
it('creates a virtual machine with the correct configuration', () => { | ||
freebsd.createVirtualMachine( | ||
hypervisorDirectory, | ||
resourcesDirectory, | ||
firmwareDirectory, | ||
config | ||
) | ||
|
||
expect(vmModule).toHaveBeenCalledOnceWith( | ||
hypervisorDirectory, | ||
resourcesDirectory, | ||
architecture, | ||
{ | ||
...config, | ||
ssHostPort: 22, | ||
cpu: 'host', | ||
accelerator: architecture.accelerator, | ||
machineType: 'pc', | ||
uuid: '864ED7F0-7876-4AA7-8511-816FABCFA87F', | ||
firmware: `${firmwareDirectory}/uefi.fd` | ||
} | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {QemuVm} from '../../../src/operating_systems/freebsd/qemu_vm' | ||
import * as arch from '../../../src/architecture' | ||
import {host} from '../../../src/host' | ||
import * as os from '../../../src/operating_systems/kind' | ||
import {Accelerator} from '../../../src/vm' | ||
import '../../../src/operating_systems/freebsd/freebsd' | ||
|
||
describe('FreeBSD QemuVm', () => { | ||
let memory = '5G' | ||
|
||
let osKind = os.Kind.for('freebsd') | ||
let architecture = arch.Architecture.for(arch.Kind.x86_64, host, osKind) | ||
let config = { | ||
memory: memory, | ||
cpuCount: 0, | ||
diskImage: '', | ||
ssHostPort: 0, | ||
cpu: '', | ||
accelerator: Accelerator.tcg, | ||
machineType: '', | ||
uuid: '', | ||
resourcesDiskImage: '', | ||
userboot: '', | ||
firmware: '' | ||
} | ||
let vm = new QemuVm('', '', architecture, config) | ||
|
||
let getFlagValue = (flag: string) => vm.command[vm.command.indexOf(flag) + 1] | ||
let actualMemory = () => getFlagValue('-m') | ||
|
||
describe('command', () => { | ||
it('constucts a command with the correct memory configuration', () => { | ||
expect(actualMemory()).toEqual(memory) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters