Reduce number of blobs in TestWalkBlobs

Reduce runtime from 170s to 3s

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2017-11-14 13:52:38 -05:00
parent c78c156feb
commit d8cf30e42e
2 changed files with 4 additions and 5 deletions

View File

@ -169,7 +169,7 @@ uninstall:
coverage: ## generate coverprofiles from the unit tests, except tests that require root
@echo "$(WHALE) $@"
@rm -f coverage.txt
go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
@go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES})
( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \
go test ${TESTFLAGS} \
-cover \
@ -183,7 +183,7 @@ coverage: ## generate coverprofiles from the unit tests, except tests that requi
root-coverage: ## generate coverage profiles for unit tests that require root
@echo "$(WHALE) $@"
go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES})
@go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES})
( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES}); do \
go test ${TESTFLAGS} \
-cover \

View File

@ -179,10 +179,9 @@ func TestWalkBlobs(t *testing.T) {
defer cleanup()
const (
nblobs = 4 << 10
nblobs = 79
maxsize = 4 << 10
)
var (
blobs = populateBlobStore(ctx, t, cs, nblobs, maxsize)
expected = map[digest.Digest]struct{}{}
@ -251,7 +250,7 @@ func generateBlobs(t checker, nblobs, maxsize int64) map[digest.Digest][]byte {
for i := int64(0); i < nblobs; i++ {
p := make([]byte, mrand.Int63n(maxsize))
if _, err := rand.Read(p); err != nil {
if _, err := mrand.Read(p); err != nil {
t.Fatal(err)
}