From 8216b94d8b9a08dc70eb3c771c809e35a2836ea1 Mon Sep 17 00:00:00 2001 From: Pedro Dias Date: Sun, 5 Apr 2020 23:05:23 +0100 Subject: [PATCH] functional tests --- test/firefracker.js | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/test/firefracker.js b/test/firefracker.js index ca2c5e5..ab6e48a 100644 --- a/test/firefracker.js +++ b/test/firefracker.js @@ -10,26 +10,51 @@ describe('#firecracker', function () { var rootImg = 'https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4'; return firecracker.downloadImage(kernelImg, os.tmpdir() + '/hello-vmlinux.bin').then(function () { - console.log('Kernel image downloaded!'); return firecracker.downloadImage(rootImg, os.tmpdir() + '/hello-rootfs.ext4'); }).then(function () { - console.log('Filesystem image downloaded!'); }).catch(function (err) { - console.log(err); expect(err).to.be.null; }); }); - it('should get info', function() { - return firecracker.info().then(function(data) { - console.log(data); + it('should use load the kernel image', function () { + return firecracker.bootSource({ + 'kernel_image_path': os.tmpdir() + '/hello-vmlinux.bin', + 'boot_args': 'console=ttyS0 reboot=k panic=1 pci=off' + }).then(function () { + }).catch(function (err) { + expect(err).to.be.null; + }); + }); + + it('should use load the filesystem image', function () { + var drive = firecracker.drive('rootfs'); + return drive.updatePreboot({ + 'path_on_host': os.tmpdir() + '/hello-rootfs.ext4', + 'is_root_device': true, + 'is_read_only': false + }).then(function () { + }).catch(function (err) { + expect(err).to.be.null; + }); + }); + }); + + describe('#firestarter', function () { + it('should get info', function () { + return firecracker.info().then(function (data) { expect(data).to.be.ok; - }, function(err) { - console.log(err); + }).catch(function (err) { + expect(err).to.be.null; + }); + }); + + it('should start microvm', function () { + return firecracker.action('InstanceStart').then(function () { + }).catch(function (err) { expect(err).to.be.null; }); }); - }); }); \ No newline at end of file