From 9366d03f001170479319878905031f63d4377c46 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 24 Apr 2018 13:12:40 +0200 Subject: dashboard/app: allow testing fixes on exact commit and without patch This implements 2 features: 1. It's now possible to specify exact commit when testing as: 2. It's possible to test without patch attached assuming the patch is already committed to the tested tree. Fixes #558 --- pkg/git/git_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'pkg/git/git_test.go') diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go index 8e23e84b2..7ad42e3dc 100644 --- a/pkg/git/git_test.go +++ b/pkg/git/git_test.go @@ -66,6 +66,7 @@ func TestCheckBranch(t *testing.T) { {"linux-4.9.y", true}, {"abi_spec", true}, {"@", false}, + {"", false}, } for _, test := range tests { res := CheckBranch(test.branch) @@ -75,6 +76,30 @@ func TestCheckBranch(t *testing.T) { } } +func TestCheckCommitHash(t *testing.T) { + var tests = []struct { + hash string + result bool + }{ + {"ff12bea91c22bba93d3ffc3034d813d686bc7eeb", true}, // 40 + {"eae05cb0aaeae05cb0aa", true}, // 20 + {"449dd6984d0eaabb", true}, // 16 + {"449dd6984d0e", true}, // 12 + {"eae05cb0aa", true}, // 10 + {"eae05cb0", true}, // 8 + {"", false}, + {"aa", false}, + {"eae05cb0aab", false}, + {"xxxxxxxx", false}, + } + for _, test := range tests { + res := CheckCommitHash(test.hash) + if res != test.result { + t.Errorf("%v: got %v, want %v", test.hash, res, test.result) + } + } +} + func TestExtractFixTags(t *testing.T) { commits, err := extractFixTags(strings.NewReader(extractFixTagsInput), extractFixTagsEmail) if err != nil { -- cgit mrf-deployment