diff options
author | Michael Muré <batolettre@gmail.com> | 2019-05-27 21:14:55 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-05-27 21:14:55 +0200 |
commit | c7abac388aadd274d4f23f996a15f8bba90f2a92 (patch) | |
tree | ced1116de500346eb340f72b7bfc672136e40c1e /tests/read_bugs_test.go | |
parent | 9865dfcdf0810e288283f2ef4eba450041db32f9 (diff) | |
download | git-bug-c7abac388aadd274d4f23f996a15f8bba90f2a92.tar.gz |
repo: refactor how test repo are created/cleaned
Diffstat (limited to 'tests/read_bugs_test.go')
-rw-r--r-- | tests/read_bugs_test.go | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/read_bugs_test.go b/tests/read_bugs_test.go index 8b4379e7..c510fdbe 100644 --- a/tests/read_bugs_test.go +++ b/tests/read_bugs_test.go @@ -6,23 +6,14 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/misc/random_bugs" "github.com/MichaelMure/git-bug/repository" - "github.com/MichaelMure/git-bug/util/test" ) -func CreateFilledRepo(bugNumber int) repository.ClockedRepo { - repo := test.CreateRepo(false) - - var seed int64 = 42 - options := random_bugs.DefaultOptions() - - options.BugNumber = bugNumber +func TestReadBugs(t *testing.T) { + repo := repository.CreateTestRepo(false) + defer repository.CleanupTestRepos(t, repo) - random_bugs.CommitRandomBugsWithSeed(repo, options, seed) - return repo -} + random_bugs.FillRepoWithSeed(repo, 15, 42) -func TestReadBugs(t *testing.T) { - repo := CreateFilledRepo(15) bugs := bug.ReadAllLocalBugs(repo) for b := range bugs { if b.Err != nil { @@ -32,7 +23,10 @@ func TestReadBugs(t *testing.T) { } func benchmarkReadBugs(bugNumber int, t *testing.B) { - repo := CreateFilledRepo(bugNumber) + repo := repository.CreateTestRepo(false) + defer repository.CleanupTestRepos(t, repo) + + random_bugs.FillRepoWithSeed(repo, bugNumber, 42) t.ResetTimer() for n := 0; n < t.N; n++ { |