MCPcopy Create free account
hub / github.com/aptly-dev/aptly / TestImportMove

Method TestImportMove

files/package_pool_test.go:271–295  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

269}
270
271func (s *PackagePoolSuite) TestImportMove(c *C) {
272 tmpDir := c.MkDir()
273 tmpPath := filepath.Join(tmpDir, filepath.Base(s.debFile))
274
275 dst, err := os.Create(tmpPath)
276 c.Assert(err, IsNil)
277
278 src, err := os.Open(s.debFile)
279 c.Assert(err, IsNil)
280
281 _, err = io.Copy(dst, src)
282 c.Assert(err, IsNil)
283
284 c.Assert(dst.Close(), IsNil)
285 c.Assert(src.Close(), IsNil)
286
287 path, err := s.pool.Import(tmpPath, filepath.Base(tmpPath), &s.checksum, true, s.cs)
288 c.Check(err, IsNil)
289 c.Check(path, Equals, "c7/6b/4bd12fd92e4dfe1b55b18a67a669_libboost-program-options-dev_1.49.0.1_i386.deb")
290
291 info, err := s.pool.Stat(path)
292 c.Assert(err, IsNil)
293 c.Check(info.Size(), Equals, int64(2738))
294 c.Check(int(info.Sys().(*syscall.Stat_t).Nlink), Equals, 1)
295}
296
297func (s *PackagePoolSuite) TestImportNotExist(c *C) {
298 _, err := s.pool.Import("no-such-file", "a.deb", &s.checksum, false, s.cs)

Callers

nothing calls this directly

Calls 8

MkDirMethod · 0.65
OpenMethod · 0.65
CloseMethod · 0.65
ImportMethod · 0.65
StatMethod · 0.65
SizeMethod · 0.65
CopyMethod · 0.45
CheckMethod · 0.45

Tested by

no test coverage detected