MCPcopy Create free account
hub / github.com/containerd/release-tool / TestParseModuleCommit

Function TestParseModuleCommit

util_test.go:21–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19import "testing"
20
21func TestParseModuleCommit(t *testing.T) {
22 for i, tc := range []struct {
23 str string
24 commit string
25 isSha bool
26 }{
27 {"v16.2.1+incompatible", "v16.2.1", false},
28 {"v0.0.0-20171204204709-577dee27f20d", "577dee27f20d", true},
29 {"v1.0.0", "v1.0.0", false},
30 {"v1.0.0-rc1", "v1.0.0-rc1", false},
31 {"v0.4.15-0.20190919025122-fc70bd9a86b5", "fc70bd9a86b5", true},
32 } {
33 commit, isSha := getCommitOrVersion(tc.str)
34 if commit != tc.commit {
35 t.Fatalf("[%d] unexpected commit %q, expected %q", i, commit, tc.commit)
36 }
37 if isSha != tc.isSha {
38 t.Fatalf("[%d] unexpected sha %t, expected %t", i, isSha, tc.isSha)
39 }
40
41 }
42}
43
44func TestGetGitURL(t *testing.T) {
45 for _, tc := range []struct {

Callers

nothing calls this directly

Calls 1

getCommitOrVersionFunction · 0.85

Tested by

no test coverage detected