MCPcopy
hub / github.com/github/git-sizer / TestBomb

Function TestBomb

git_sizer_test.go:557–610  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

555}
556
557func TestBomb(t *testing.T) {
558 t.Parallel()
559
560 repo := testutils.NewTestRepo(t, true, "bomb")
561 t.Cleanup(func() { repo.Remove(t) })
562
563 newGitBomb(t, repo, 10, 10, "boom!\n")
564
565 h, err := sizes.ScanRepositoryUsingGraph(
566 repo.Repository(t),
567 refGrouper{}, sizes.NameStyleFull, meter.NoProgressMeter,
568 )
569 require.NoError(t, err)
570
571 assert.Equal(t, counts.Count32(1), h.UniqueCommitCount, "unique commit count")
572 assert.Equal(t, counts.Count64(172), h.UniqueCommitSize, "unique commit size")
573 assert.Equal(t, counts.Count32(172), h.MaxCommitSize, "max commit size")
574 assert.Equal(t, "refs/heads/master", h.MaxCommitSizeCommit.Path(), "max commit size commit")
575 assert.Equal(t, counts.Count32(1), h.MaxHistoryDepth, "max history depth")
576 assert.Equal(t, counts.Count32(0), h.MaxParentCount, "max parent count")
577 assert.Equal(t, "refs/heads/master", h.MaxParentCountCommit.Path(), "max parent count commit")
578
579 assert.Equal(t, counts.Count32(10), h.UniqueTreeCount, "unique tree count")
580 assert.Equal(t, counts.Count64(2910), h.UniqueTreeSize, "unique tree size")
581 assert.Equal(t, counts.Count64(100), h.UniqueTreeEntries, "unique tree entries")
582 assert.Equal(t, counts.Count32(10), h.MaxTreeEntries, "max tree entries")
583 assert.Equal(t, "refs/heads/master:d0/d0/d0/d0/d0/d0/d0/d0/d0", h.MaxTreeEntriesTree.Path(), "max tree entries tree")
584
585 assert.Equal(t, counts.Count32(1), h.UniqueBlobCount, "unique blob count")
586 assert.Equal(t, counts.Count64(6), h.UniqueBlobSize, "unique blob size")
587 assert.Equal(t, counts.Count32(6), h.MaxBlobSize, "max blob size")
588 assert.Equal(t, "refs/heads/master:d0/d0/d0/d0/d0/d0/d0/d0/d0/f0", h.MaxBlobSizeBlob.Path(), "max blob size blob")
589
590 assert.Equal(t, counts.Count32(0), h.UniqueTagCount, "unique tag count")
591 assert.Equal(t, counts.Count32(0), h.MaxTagDepth, "max tag depth")
592
593 assert.Equal(t, counts.Count32(1), h.ReferenceCount, "reference count")
594
595 assert.Equal(t, counts.Count32(10), h.MaxPathDepth, "max path depth")
596 assert.Equal(t, "refs/heads/master^{tree}", h.MaxPathDepthTree.Path(), "max path depth tree")
597 assert.Equal(t, counts.Count32(29), h.MaxPathLength, "max path length")
598 assert.Equal(t, "refs/heads/master^{tree}", h.MaxPathLengthTree.Path(), "max path length tree")
599
600 assert.Equal(t, counts.Count32((pow(10, 10)-1)/(10-1)), h.MaxExpandedTreeCount, "max expanded tree count")
601 assert.Equal(t, "refs/heads/master^{tree}", h.MaxExpandedTreeCountTree.Path(), "max expanded tree count tree")
602 assert.Equal(t, counts.Count32(0xffffffff), h.MaxExpandedBlobCount, "max expanded blob count")
603 assert.Equal(t, "refs/heads/master^{tree}", h.MaxExpandedBlobCountTree.Path(), "max expanded blob count tree")
604 assert.Equal(t, counts.Count64(6*pow(10, 10)), h.MaxExpandedBlobSize, "max expanded blob size")
605 assert.Equal(t, "refs/heads/master^{tree}", h.MaxExpandedBlobSizeTree.Path(), "max expanded blob size tree")
606 assert.Equal(t, counts.Count32(0), h.MaxExpandedLinkCount, "max expanded link count")
607 assert.Nil(t, h.MaxExpandedLinkCountTree, "max expanded link count tree")
608 assert.Equal(t, counts.Count32(0), h.MaxExpandedSubmoduleCount, "max expanded submodule count")
609 assert.Nil(t, h.MaxExpandedSubmoduleCountTree, "max expanded submodule count tree")
610}
611
612func TestTaggedTags(t *testing.T) {
613 t.Parallel()

Callers

nothing calls this directly

Calls 9

RemoveMethod · 0.95
RepositoryMethod · 0.95
NewTestRepoFunction · 0.92
ScanRepositoryUsingGraphFunction · 0.92
Count32TypeAlias · 0.92
Count64TypeAlias · 0.92
newGitBombFunction · 0.85
powFunction · 0.85
PathMethod · 0.45

Tested by

no test coverage detected