MCPcopy
hub / github.com/cubefs/cubefs / testDelDirSnapshotVersion

Function testDelDirSnapshotVersion

metanode/multi_ver_test.go:614–685  ·  view source on GitHub ↗
(t *testing.T, verSeq uint64, dirIno *Inode, dirDentry *Dentry)

Source from the content-addressed store, hash-verified

612}
613
614func testDelDirSnapshotVersion(t *testing.T, verSeq uint64, dirIno *Inode, dirDentry *Dentry) {
615 if verSeq != 0 {
616 assert.True(t, testVerListRemoveVer(t, verSeq))
617 }
618
619 rspReadDir := testReadDirAll(t, verSeq, dirIno.Inode)
620 // testPrintAllDentry(t)
621
622 rDirIno := dirIno.Copy().(*Inode)
623 rDirIno.setVerNoCheck(verSeq)
624
625 rspDelIno := mp.fsmUnlinkInode(rDirIno, 0)
626
627 t.Logf("rspDelinfo ret %v content %v", rspDelIno.Status, rspDelIno)
628 assert.True(t, rspDelIno.Status == proto.OpOk)
629 if rspDelIno.Status != proto.OpOk {
630 return
631 }
632 rDirDentry := dirDentry.Copy().(*Dentry)
633 rDirDentry.setVerSeq(verSeq)
634 rspDelDen := mp.fsmDeleteDentry(rDirDentry, false)
635 assert.True(t, rspDelDen.Status == proto.OpOk)
636
637 for idx, info := range rspReadDir.Children {
638 t.Logf("testDelDirSnapshotVersion: delseq [%v] to del idx %v infof %v", verSeq, idx, info)
639 rino := &Inode{
640 Inode: info.Inode,
641 Type: FileModeType,
642 multiSnap: &InodeMultiSnap{
643 verSeq: verSeq,
644 },
645 }
646 testPrintInodeInfo(t, rino)
647 log.LogDebugf("testDelDirSnapshotVersion get rino[%v] start", rino)
648 t.Logf("testDelDirSnapshotVersion get rino[%v] start", rino)
649 ino := mp.getInode(rino, false)
650 log.LogDebugf("testDelDirSnapshotVersion get rino[%v] end", ino)
651 t.Logf("testDelDirSnapshotVersion get rino[%v] end", rino)
652 assert.True(t, ino.Status == proto.OpOk)
653 if ino.Status != proto.OpOk {
654 panic(nil)
655 }
656 rino.setVer(verSeq)
657 rspDelIno = mp.fsmUnlinkInode(rino, 0)
658
659 assert.True(t, rspDelIno.Status == proto.OpOk || rspDelIno.Status == proto.OpNotExistErr)
660 if rspDelIno.Status != proto.OpOk && rspDelIno.Status != proto.OpNotExistErr {
661 t.Logf("testDelDirSnapshotVersion: rspDelino[%v] return st %v", rspDelIno, proto.ParseErrorCode(int32(rspDelIno.Status)))
662 panic(nil)
663 }
664 dentry := &Dentry{
665 ParentId: rDirIno.Inode,
666 Name: info.Name,
667 Type: FileModeType,
668 multiSnap: NewDentrySnap(verSeq),
669 Inode: rino.Inode,
670 }
671 log.LogDebugf("test.testDelDirSnapshotVersion: dentry param %v ", dentry)

Callers 1

TestDentryFunction · 0.85

Calls 14

setVerMethod · 0.95
LogDebugfFunction · 0.92
ParseErrorCodeFunction · 0.92
testVerListRemoveVerFunction · 0.85
testReadDirAllFunction · 0.85
testPrintInodeInfoFunction · 0.85
NewDentrySnapFunction · 0.85
setVerNoCheckMethod · 0.80
fsmUnlinkInodeMethod · 0.80
setVerSeqMethod · 0.80
fsmDeleteDentryMethod · 0.80
CopyMethod · 0.65

Tested by

no test coverage detected