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

Method TestDebugMode

gcs/public_test.go:456–479  ·  view source on GitHub ↗

TestDebugMode exercises the if-debug log branches across the main verbs.

(c *C)

Source from the content-addressed store, hash-verified

454
455// TestDebugMode exercises the if-debug log branches across the main verbs.
456func (s *PublishedStorageSuite) TestDebugMode(c *C) {
457 st, err := NewPublishedStorage("test", "", "", "", "", "", "", "", "", false, true)
458 c.Assert(err, IsNil)
459
460 dir := c.MkDir()
461 src := filepath.Join(dir, "f")
462 c.Assert(os.WriteFile(src, []byte("dbg"), 0644), IsNil)
463
464 c.Check(st.PutFile("d/a", src), IsNil)
465 c.Check(st.RenameFile("d/a", "d/b"), IsNil)
466 c.Check(st.SymLink("d/b", "d/b.link"), IsNil)
467 c.Check(st.HardLink("d/b", "d/b.hard"), IsNil)
468 c.Check(st.Remove("d/b"), IsNil)
469 c.Check(st.RemoveDirs("d", nil), IsNil)
470
471 pool := files.NewPackagePool(c.MkDir(), false)
472 cs := files.NewMockChecksumStorage()
473 tmp := filepath.Join(c.MkDir(), "x.deb")
474 c.Assert(os.WriteFile(tmp, []byte("Contents"), 0644), IsNil)
475 cksum := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
476 srcKey, err := pool.Import(tmp, "x.deb", &cksum, true, cs)
477 c.Assert(err, IsNil)
478 c.Check(st.LinkFromPool("", "pool/x", "x.deb", pool, srcKey, cksum, false), IsNil)
479}
480
481// TestObjectHandleWithEncryptionKey covers the encryptionKey branch in
482// objectHandle. fsouza doesn't enforce CSEK headers but we just need to walk

Callers

nothing calls this directly

Calls 13

PutFileMethod · 0.95
RenameFileMethod · 0.95
SymLinkMethod · 0.95
HardLinkMethod · 0.95
RemoveMethod · 0.95
RemoveDirsMethod · 0.95
ImportMethod · 0.95
LinkFromPoolMethod · 0.95
NewPackagePoolFunction · 0.92
NewMockChecksumStorageFunction · 0.92
NewPublishedStorageFunction · 0.70
MkDirMethod · 0.65

Tested by

no test coverage detected