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

Method TestRemove

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

Source from the content-addressed store, hash-verified

69}
70
71func (s *PackagePoolSuite) TestRemove(c *C) {
72 _ = os.MkdirAll(filepath.Join(s.pool.rootPath, "bd", "0b"), 0755)
73 _ = os.MkdirAll(filepath.Join(s.pool.rootPath, "bd", "0a"), 0755)
74 _ = os.MkdirAll(filepath.Join(s.pool.rootPath, "ae", "0c"), 0755)
75
76 _ = os.WriteFile(filepath.Join(s.pool.rootPath, "ae", "0c", "1.deb"), []byte("1"), 0644)
77 _ = os.WriteFile(filepath.Join(s.pool.rootPath, "ae", "0c", "2.deb"), []byte("22"), 0644)
78 _ = os.WriteFile(filepath.Join(s.pool.rootPath, "bd", "0a", "3.deb"), []byte("333"), 0644)
79 _ = os.WriteFile(filepath.Join(s.pool.rootPath, "bd", "0b", "4.deb"), []byte("4444"), 0644)
80
81 size, err := s.pool.Remove("ae/0c/2.deb")
82 c.Check(err, IsNil)
83 c.Check(size, Equals, int64(2))
84
85 _, err = s.pool.Remove("ae/0c/2.deb")
86 c.Check(err, ErrorMatches, ".*no such file or directory")
87
88 list, err := s.pool.FilepathList(nil)
89 c.Check(err, IsNil)
90 c.Check(list, DeepEquals, []string{"ae/0c/1.deb", "bd/0a/3.deb", "bd/0b/4.deb"})
91}
92
93func isSameDevice(s *PackagePoolSuite) bool {
94 poolPath, _ := s.pool.buildPoolPath(filepath.Base(s.debFile), &s.checksum)

Callers

nothing calls this directly

Calls 3

RemoveMethod · 0.65
FilepathListMethod · 0.65
CheckMethod · 0.45

Tested by

no test coverage detected