diff options
author | John Cai <jcai@gitlab.com> | 2020-05-07 19:16:20 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2020-05-07 19:16:20 +0300 |
commit | c084bba787c307cd50a9fb3bf226501b33971f2a (patch) | |
tree | 693653921e75497960192ffe244d67156012dff4 /internal/testhelper | |
parent | e722ef12014474b8ee6dac5ce6edb4013238936f (diff) |
Add optimizeRepository helper
optimizeRepository is a helper function that is used to do a full repack
on repositories that do not have a bitmap file
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testhelper.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index f8bbe249b..c3521cd26 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -701,6 +701,17 @@ STDIN.each_line do |line| end ` +func WriteBlobs(t testing.TB, testRepoPath string, n int) []string { + var blobIDs []string + for i := 0; i < n; i++ { + var stdin bytes.Buffer + stdin.Write([]byte(strconv.Itoa(time.Now().Nanosecond()))) + blobIDs = append(blobIDs, text.ChompBytes(MustRunCommand(t, &stdin, "git", "-C", testRepoPath, "hash-object", "-w", "--stdin"))) + } + + return blobIDs +} + // FeatureSet is a representation of a set of features that are enabled // This is useful in situations where a test needs to test any combination of features toggled on and off type FeatureSet struct { |