func (s *PartitionTestSuite) TestSyncBootFilesWithAssets(c *C) {
	err := os.MkdirAll(bootloaderGrubDir, 0755)
	c.Assert(err, IsNil)

	runCommand = mockRunCommand
	b := grub{
		bootloaderType{
			currentBootPath: c.MkDir(),
			otherBootPath:   c.MkDir(),
			bootloaderDir:   c.MkDir(),
		},
	}

	bootfile := filepath.Join(c.MkDir(), "bootfile")
	err = ioutil.WriteFile(bootfile, []byte(bootfile), 0644)
	c.Assert(err, IsNil)

	bootassets := map[string]string{
		bootfile: filepath.Base(bootfile),
	}

	err = b.SyncBootFiles(bootassets)
	c.Assert(err, IsNil)

	dst := filepath.Join(b.bootloaderDir, bootassets[bootfile])
	c.Check(helpers.FileExists(dst), Equals, true)
	c.Check(helpers.FilesAreEqual(bootfile, dst), Equals, true)
}
Example #2
0
func (s *SquashfsTestSuite) TestCopyBlob(c *C) {
	snap := makeSnap(c, "name: foo", "")
	dst := filepath.Join(c.MkDir(), "blob.snap")

	err := snap.CopyBlob(dst)
	c.Assert(err, IsNil)
	c.Assert(helpers.FilesAreEqual(snap.Name(), dst), Equals, true)
}