pipeline_test.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. package core
  2. import (
  3. "errors"
  4. "fmt"
  5. "io"
  6. "io/ioutil"
  7. "os"
  8. "testing"
  9. "time"
  10. "github.com/stretchr/testify/assert"
  11. "gopkg.in/src-d/go-git.v4"
  12. "gopkg.in/src-d/go-git.v4/plumbing"
  13. "gopkg.in/src-d/go-git.v4/plumbing/object"
  14. "gopkg.in/src-d/hercules.v4/internal/pb"
  15. "gopkg.in/src-d/hercules.v4/internal/test"
  16. )
  17. type testPipelineItem struct {
  18. Initialized bool
  19. DepsConsumed bool
  20. Forked bool
  21. Merged *bool
  22. CommitMatches bool
  23. IndexMatches bool
  24. TestError bool
  25. }
  26. func (item *testPipelineItem) Name() string {
  27. return "Test"
  28. }
  29. func (item *testPipelineItem) Provides() []string {
  30. arr := [...]string{"test"}
  31. return arr[:]
  32. }
  33. func (item *testPipelineItem) Requires() []string {
  34. return []string{}
  35. }
  36. func (item *testPipelineItem) Configure(facts map[string]interface{}) {
  37. }
  38. func (item *testPipelineItem) ListConfigurationOptions() []ConfigurationOption {
  39. options := [...]ConfigurationOption{{
  40. Name: "TestOption",
  41. Description: "The option description.",
  42. Flag: "test-option",
  43. Type: IntConfigurationOption,
  44. Default: 10,
  45. }}
  46. return options[:]
  47. }
  48. func (item *testPipelineItem) Flag() string {
  49. return "mytest"
  50. }
  51. func (item *testPipelineItem) Features() []string {
  52. f := [...]string{"power"}
  53. return f[:]
  54. }
  55. func (item *testPipelineItem) Initialize(repository *git.Repository) {
  56. item.Initialized = repository != nil
  57. }
  58. func (item *testPipelineItem) Consume(deps map[string]interface{}) (map[string]interface{}, error) {
  59. if item.TestError {
  60. return nil, errors.New("error")
  61. }
  62. obj, exists := deps[DependencyCommit]
  63. item.DepsConsumed = exists
  64. if item.DepsConsumed {
  65. commit := obj.(*object.Commit)
  66. item.CommitMatches = commit.Hash == plumbing.NewHash(
  67. "af9ddc0db70f09f3f27b4b98e415592a7485171c")
  68. obj, item.DepsConsumed = deps[DependencyIndex]
  69. if item.DepsConsumed {
  70. item.IndexMatches = obj.(int) == 0
  71. }
  72. }
  73. return map[string]interface{}{"test": item}, nil
  74. }
  75. func (item *testPipelineItem) Fork(n int) []PipelineItem {
  76. result := make([]PipelineItem, n)
  77. for i := 0; i < n; i++ {
  78. result[i] = &testPipelineItem{Merged: item.Merged}
  79. }
  80. item.Forked = true
  81. return result
  82. }
  83. func (item *testPipelineItem) Merge(branches []PipelineItem) {
  84. *item.Merged = true
  85. }
  86. func (item *testPipelineItem) Finalize() interface{} {
  87. return item
  88. }
  89. func (item *testPipelineItem) Serialize(result interface{}, binary bool, writer io.Writer) error {
  90. return nil
  91. }
  92. type dependingTestPipelineItem struct {
  93. DependencySatisfied bool
  94. TestNilConsumeReturn bool
  95. }
  96. func (item *dependingTestPipelineItem) Name() string {
  97. return "Test2"
  98. }
  99. func (item *dependingTestPipelineItem) Provides() []string {
  100. arr := [...]string{"test2"}
  101. return arr[:]
  102. }
  103. func (item *dependingTestPipelineItem) Requires() []string {
  104. arr := [...]string{"test"}
  105. return arr[:]
  106. }
  107. func (item *dependingTestPipelineItem) ListConfigurationOptions() []ConfigurationOption {
  108. options := [...]ConfigurationOption{{
  109. Name: "TestOption2",
  110. Description: "The option description.",
  111. Flag: "test-option2",
  112. Type: IntConfigurationOption,
  113. Default: 10,
  114. }}
  115. return options[:]
  116. }
  117. func (item *dependingTestPipelineItem) Configure(facts map[string]interface{}) {
  118. }
  119. func (item *dependingTestPipelineItem) Initialize(repository *git.Repository) {
  120. }
  121. func (item *dependingTestPipelineItem) Flag() string {
  122. return "depflag"
  123. }
  124. func (item *dependingTestPipelineItem) Consume(deps map[string]interface{}) (map[string]interface{}, error) {
  125. _, exists := deps["test"]
  126. item.DependencySatisfied = exists
  127. if !item.TestNilConsumeReturn {
  128. return map[string]interface{}{"test2": item}, nil
  129. }
  130. return nil, nil
  131. }
  132. func (item *dependingTestPipelineItem) Fork(n int) []PipelineItem {
  133. return nil
  134. }
  135. func (item *dependingTestPipelineItem) Merge(branches []PipelineItem) {
  136. }
  137. func (item *dependingTestPipelineItem) Finalize() interface{} {
  138. return true
  139. }
  140. func (item *dependingTestPipelineItem) Serialize(result interface{}, binary bool, writer io.Writer) error {
  141. return nil
  142. }
  143. func TestPipelineFacts(t *testing.T) {
  144. pipeline := NewPipeline(test.Repository)
  145. pipeline.SetFact("fact", "value")
  146. assert.Equal(t, pipeline.GetFact("fact"), "value")
  147. }
  148. func TestPipelineFeatures(t *testing.T) {
  149. pipeline := NewPipeline(test.Repository)
  150. pipeline.SetFeature("feat")
  151. val, _ := pipeline.GetFeature("feat")
  152. assert.True(t, val)
  153. _, exists := pipeline.GetFeature("!")
  154. assert.False(t, exists)
  155. Registry.featureFlags.Set("777")
  156. defer func() {
  157. Registry.featureFlags = arrayFeatureFlags{Flags: []string{}, Choices: map[string]bool{}}
  158. }()
  159. pipeline.SetFeaturesFromFlags()
  160. _, exists = pipeline.GetFeature("777")
  161. assert.False(t, exists)
  162. assert.Panics(t, func() {
  163. pipeline.SetFeaturesFromFlags(
  164. &PipelineItemRegistry{}, &PipelineItemRegistry{})
  165. })
  166. }
  167. func TestPipelineRun(t *testing.T) {
  168. pipeline := NewPipeline(test.Repository)
  169. item := &testPipelineItem{Merged: new(bool)}
  170. pipeline.AddItem(item)
  171. pipeline.Initialize(map[string]interface{}{})
  172. assert.True(t, item.Initialized)
  173. commits := make([]*object.Commit, 1)
  174. commits[0], _ = test.Repository.CommitObject(plumbing.NewHash(
  175. "af9ddc0db70f09f3f27b4b98e415592a7485171c"))
  176. result, err := pipeline.Run(commits)
  177. assert.Nil(t, err)
  178. assert.Equal(t, 2, len(result))
  179. assert.Equal(t, item, result[item].(*testPipelineItem))
  180. common := result[nil].(*CommonAnalysisResult)
  181. assert.Equal(t, common.BeginTime, int64(1481719092))
  182. assert.Equal(t, common.EndTime, int64(1481719092))
  183. assert.Equal(t, common.CommitsNumber, 1)
  184. assert.True(t, common.RunTime.Nanoseconds()/1e6 < 100)
  185. assert.True(t, item.DepsConsumed)
  186. assert.True(t, item.CommitMatches)
  187. assert.True(t, item.IndexMatches)
  188. assert.False(t, item.Forked)
  189. assert.False(t, *item.Merged)
  190. pipeline.RemoveItem(item)
  191. result, err = pipeline.Run(commits)
  192. assert.Nil(t, err)
  193. assert.Equal(t, 1, len(result))
  194. }
  195. func TestPipelineRunBranches(t *testing.T) {
  196. pipeline := NewPipeline(test.Repository)
  197. item := &testPipelineItem{Merged: new(bool)}
  198. pipeline.AddItem(item)
  199. pipeline.Initialize(map[string]interface{}{})
  200. assert.True(t, item.Initialized)
  201. commits := make([]*object.Commit, 5)
  202. hashes := []string {
  203. "6db8065cdb9bb0758f36a7e75fc72ab95f9e8145",
  204. "f30daba81ff2bf0b3ba02a1e1441e74f8a4f6fee",
  205. "8a03b5620b1caa72ec9cb847ea88332621e2950a",
  206. "dd9dd084d5851d7dc4399fc7dbf3d8292831ebc5",
  207. "f4ed0405b14f006c0744029d87ddb3245607587a",
  208. }
  209. for i, h := range hashes {
  210. var err error
  211. commits[i], err = test.Repository.CommitObject(plumbing.NewHash(h))
  212. if err != nil {
  213. t.Fatal(err)
  214. }
  215. }
  216. result, err := pipeline.Run(commits)
  217. assert.Nil(t, err)
  218. assert.True(t, item.Forked)
  219. assert.True(t, *item.Merged)
  220. assert.Equal(t, 2, len(result))
  221. assert.Equal(t, item, result[item].(*testPipelineItem))
  222. common := result[nil].(*CommonAnalysisResult)
  223. assert.Equal(t, common.CommitsNumber, 5)
  224. }
  225. func TestPipelineOnProgress(t *testing.T) {
  226. pipeline := NewPipeline(test.Repository)
  227. progressOk := 0
  228. onProgress := func(step int, total int) {
  229. if step == 1 && total == 3 {
  230. progressOk++
  231. }
  232. if step == 2 && total == 3 {
  233. progressOk++
  234. }
  235. if step == 3 && total == 3 {
  236. progressOk++
  237. }
  238. }
  239. pipeline.OnProgress = onProgress
  240. commits := make([]*object.Commit, 1)
  241. commits[0], _ = test.Repository.CommitObject(plumbing.NewHash(
  242. "af9ddc0db70f09f3f27b4b98e415592a7485171c"))
  243. result, err := pipeline.Run(commits)
  244. assert.Nil(t, err)
  245. assert.Equal(t, 1, len(result))
  246. assert.Equal(t, 3, progressOk)
  247. }
  248. func TestPipelineCommits(t *testing.T) {
  249. pipeline := NewPipeline(test.Repository)
  250. commits := pipeline.Commits()
  251. assert.True(t, len(commits) >= 100)
  252. hashMap := map[plumbing.Hash]bool{}
  253. for _, c := range commits {
  254. hashMap[c.Hash] = true
  255. }
  256. assert.Equal(t, len(commits), len(hashMap))
  257. assert.Contains(t, hashMap, plumbing.NewHash(
  258. "cce947b98a050c6d356bc6ba95030254914027b1"))
  259. }
  260. func TestLoadCommitsFromFile(t *testing.T) {
  261. tmp, err := ioutil.TempFile("", "hercules-test-")
  262. assert.Nil(t, err)
  263. tmp.WriteString("cce947b98a050c6d356bc6ba95030254914027b1\n6db8065cdb9bb0758f36a7e75fc72ab95f9e8145")
  264. tmp.Close()
  265. defer os.Remove(tmp.Name())
  266. commits, err := LoadCommitsFromFile(tmp.Name(), test.Repository)
  267. assert.Nil(t, err)
  268. assert.Equal(t, len(commits), 2)
  269. assert.Equal(t, commits[0].Hash, plumbing.NewHash(
  270. "cce947b98a050c6d356bc6ba95030254914027b1"))
  271. assert.Equal(t, commits[1].Hash, plumbing.NewHash(
  272. "6db8065cdb9bb0758f36a7e75fc72ab95f9e8145"))
  273. commits, err = LoadCommitsFromFile("/WAT?xxx!", test.Repository)
  274. assert.Nil(t, commits)
  275. assert.NotNil(t, err)
  276. tmp, err = ioutil.TempFile("", "hercules-test-")
  277. assert.Nil(t, err)
  278. tmp.WriteString("WAT")
  279. tmp.Close()
  280. defer os.Remove(tmp.Name())
  281. commits, err = LoadCommitsFromFile(tmp.Name(), test.Repository)
  282. assert.Nil(t, commits)
  283. assert.NotNil(t, err)
  284. tmp, err = ioutil.TempFile("", "hercules-test-")
  285. assert.Nil(t, err)
  286. tmp.WriteString("ffffffffffffffffffffffffffffffffffffffff")
  287. tmp.Close()
  288. defer os.Remove(tmp.Name())
  289. commits, err = LoadCommitsFromFile(tmp.Name(), test.Repository)
  290. assert.Nil(t, commits)
  291. assert.NotNil(t, err)
  292. }
  293. func TestPipelineDeps(t *testing.T) {
  294. pipeline := NewPipeline(test.Repository)
  295. item1 := &dependingTestPipelineItem{}
  296. item2 := &testPipelineItem{}
  297. pipeline.AddItem(item1)
  298. pipeline.AddItem(item2)
  299. assert.Equal(t, pipeline.Len(), 2)
  300. pipeline.Initialize(map[string]interface{}{})
  301. commits := make([]*object.Commit, 1)
  302. commits[0], _ = test.Repository.CommitObject(plumbing.NewHash(
  303. "af9ddc0db70f09f3f27b4b98e415592a7485171c"))
  304. result, err := pipeline.Run(commits)
  305. assert.Nil(t, err)
  306. assert.True(t, result[item1].(bool))
  307. assert.Equal(t, result[item2], item2)
  308. item1.TestNilConsumeReturn = true
  309. assert.Panics(t, func() { pipeline.Run(commits) })
  310. }
  311. func TestPipelineDeployFeatures(t *testing.T) {
  312. pipeline := NewPipeline(test.Repository)
  313. pipeline.DeployItem(&testPipelineItem{})
  314. f, _ := pipeline.GetFeature("power")
  315. assert.True(t, f)
  316. }
  317. func TestPipelineError(t *testing.T) {
  318. pipeline := NewPipeline(test.Repository)
  319. item := &testPipelineItem{}
  320. item.TestError = true
  321. pipeline.AddItem(item)
  322. pipeline.Initialize(map[string]interface{}{})
  323. commits := make([]*object.Commit, 1)
  324. commits[0], _ = test.Repository.CommitObject(plumbing.NewHash(
  325. "af9ddc0db70f09f3f27b4b98e415592a7485171c"))
  326. result, err := pipeline.Run(commits)
  327. assert.Nil(t, result)
  328. assert.NotNil(t, err)
  329. }
  330. func TestCommonAnalysisResultMerge(t *testing.T) {
  331. c1 := CommonAnalysisResult{
  332. BeginTime: 1513620635, EndTime: 1513720635, CommitsNumber: 1, RunTime: 100}
  333. assert.Equal(t, c1.BeginTimeAsTime().Unix(), int64(1513620635))
  334. assert.Equal(t, c1.EndTimeAsTime().Unix(), int64(1513720635))
  335. c2 := CommonAnalysisResult{
  336. BeginTime: 1513620535, EndTime: 1513730635, CommitsNumber: 2, RunTime: 200}
  337. c1.Merge(&c2)
  338. assert.Equal(t, c1.BeginTime, int64(1513620535))
  339. assert.Equal(t, c1.EndTime, int64(1513730635))
  340. assert.Equal(t, c1.CommitsNumber, 3)
  341. assert.Equal(t, c1.RunTime.Nanoseconds(), int64(300))
  342. }
  343. func TestCommonAnalysisResultMetadata(t *testing.T) {
  344. c1 := &CommonAnalysisResult{
  345. BeginTime: 1513620635, EndTime: 1513720635, CommitsNumber: 1, RunTime: 100 * 1e6}
  346. meta := &pb.Metadata{}
  347. c1 = MetadataToCommonAnalysisResult(c1.FillMetadata(meta))
  348. assert.Equal(t, c1.BeginTimeAsTime().Unix(), int64(1513620635))
  349. assert.Equal(t, c1.EndTimeAsTime().Unix(), int64(1513720635))
  350. assert.Equal(t, c1.CommitsNumber, 1)
  351. assert.Equal(t, c1.RunTime.Nanoseconds(), int64(100*1e6))
  352. }
  353. func TestConfigurationOptionTypeString(t *testing.T) {
  354. opt := ConfigurationOptionType(0)
  355. assert.Equal(t, opt.String(), "")
  356. opt = ConfigurationOptionType(1)
  357. assert.Equal(t, opt.String(), "int")
  358. opt = ConfigurationOptionType(2)
  359. assert.Equal(t, opt.String(), "string")
  360. opt = ConfigurationOptionType(3)
  361. assert.Equal(t, opt.String(), "float")
  362. opt = ConfigurationOptionType(4)
  363. assert.Equal(t, opt.String(), "string")
  364. opt = ConfigurationOptionType(5)
  365. assert.Panics(t, func() { _ = opt.String() })
  366. }
  367. func TestConfigurationOptionFormatDefault(t *testing.T) {
  368. opt := ConfigurationOption{Type: StringConfigurationOption, Default: "ololo"}
  369. assert.Equal(t, opt.FormatDefault(), "\"ololo\"")
  370. opt = ConfigurationOption{Type: IntConfigurationOption, Default: 7}
  371. assert.Equal(t, opt.FormatDefault(), "7")
  372. opt = ConfigurationOption{Type: BoolConfigurationOption, Default: false}
  373. assert.Equal(t, opt.FormatDefault(), "false")
  374. opt = ConfigurationOption{Type: FloatConfigurationOption, Default: 0.5}
  375. assert.Equal(t, opt.FormatDefault(), "0.5")
  376. }
  377. func TestPrepareRunPlanTiny(t *testing.T) {
  378. rootCommit, err := test.Repository.CommitObject(plumbing.NewHash(
  379. "cce947b98a050c6d356bc6ba95030254914027b1"))
  380. if err != nil {
  381. t.Fatal(err)
  382. }
  383. plan := prepareRunPlan([]*object.Commit{rootCommit})
  384. assert.Len(t, plan, 1)
  385. assert.Equal(t, runActionCommit, plan[0].Action)
  386. assert.Equal(t, 0, plan[0].Items[0])
  387. assert.Equal(t, "cce947b98a050c6d356bc6ba95030254914027b1", plan[0].Commit.Hash.String())
  388. }
  389. func TestPrepareRunPlanSmall(t *testing.T) {
  390. cit, err := test.Repository.Log(&git.LogOptions{From: plumbing.ZeroHash})
  391. if err != nil {
  392. panic(err)
  393. }
  394. defer cit.Close()
  395. var commits []*object.Commit
  396. timeCutoff := time.Date(2016, 12, 15, 0, 0, 0, 0, time.FixedZone("CET", 7200))
  397. cit.ForEach(func(commit *object.Commit) error {
  398. reliableTime := time.Date(commit.Author.When.Year(), commit.Author.When.Month(),
  399. commit.Author.When.Day(), commit.Author.When.Hour(), commit.Author.When.Minute(),
  400. commit.Author.When.Second(), 0, time.FixedZone("CET", 7200))
  401. if reliableTime.Before(timeCutoff) {
  402. commits = append(commits, commit)
  403. }
  404. return nil
  405. })
  406. plan := prepareRunPlan(commits)
  407. /*for _, p := range plan {
  408. if p.Commit != nil {
  409. fmt.Println(p.Action, p.Commit.Hash.String(), p.Items)
  410. } else {
  411. fmt.Println(p.Action, strings.Repeat(" ", 40), p.Items)
  412. }
  413. }*/
  414. // fork, merge and one artificial commit per branch
  415. assert.Len(t, plan, len(commits))
  416. assert.Equal(t, runActionCommit, plan[0].Action)
  417. assert.Equal(t, 0, plan[0].Items[0])
  418. assert.Equal(t, "cce947b98a050c6d356bc6ba95030254914027b1", plan[0].Commit.Hash.String())
  419. assert.Equal(t, runActionCommit, plan[1].Action)
  420. assert.Equal(t, 0, plan[1].Items[0])
  421. assert.Equal(t, "a3ee37f91f0d705ec9c41ae88426f0ae44b2fbc3", plan[1].Commit.Hash.String())
  422. assert.Equal(t, runActionCommit, plan[9].Action)
  423. assert.Equal(t, 0, plan[9].Items[0])
  424. assert.Equal(t, "a28e9064c70618dc9d68e1401b889975e0680d11", plan[9].Commit.Hash.String())
  425. }
  426. func TestPrepareRunPlanBig(t *testing.T) {
  427. cases := [][7]int {
  428. {2017, 8, 9, 0, 0, 0, 0},
  429. {2017, 8, 10, 0, 0, 0, 0},
  430. {2017, 8, 24, 1, 1, 1, 1},
  431. {2017, 9, 19, 1-2, 1, 1, 1},
  432. {2017, 9, 23, 1-2, 1, 1, 1},
  433. {2017, 12, 8, 1, 1, 1, 1},
  434. {2017, 12, 9, 1, 1, 1, 1},
  435. {2017, 12, 10, 1, 1, 1, 1},
  436. {2017, 12, 11, 2, 2, 2, 2},
  437. {2017, 12, 19, 4, 4, 4, 4},
  438. {2017, 12, 27, 4, 4, 4, 4},
  439. {2018, 1, 10, 4, 4, 4, 4},
  440. {2018, 1, 16, 4, 4, 4, 4},
  441. {2018, 1, 18, 5, 6, 5, 5},
  442. {2018, 1, 23, 6, 6, 6, 6},
  443. {2018, 3, 12, 7, 7, 7, 7},
  444. {2018, 5, 13, 7, 7, 7, 7},
  445. {2018, 5, 16, 10, 9, 10, 9},
  446. }
  447. for _, testCase := range cases {
  448. func() {
  449. cit, err := test.Repository.Log(&git.LogOptions{From: plumbing.ZeroHash})
  450. if err != nil {
  451. panic(err)
  452. }
  453. defer cit.Close()
  454. var commits []*object.Commit
  455. timeCutoff := time.Date(
  456. testCase[0], time.Month(testCase[1]), testCase[2], 0, 0, 0, 0, time.FixedZone("CET", 7200))
  457. cit.ForEach(func(commit *object.Commit) error {
  458. reliableTime := time.Date(commit.Author.When.Year(), commit.Author.When.Month(),
  459. commit.Author.When.Day(), commit.Author.When.Hour(), commit.Author.When.Minute(),
  460. commit.Author.When.Second(), 0, time.FixedZone("CET", 7200))
  461. if reliableTime.Before(timeCutoff) {
  462. commits = append(commits, commit)
  463. }
  464. return nil
  465. })
  466. plan := prepareRunPlan(commits)
  467. /*for _, p := range plan {
  468. if p.Commit != nil {
  469. fmt.Println(p.Action, p.Commit.Hash.String(), p.Items)
  470. } else {
  471. fmt.Println(p.Action, strings.Repeat(" ", 40), p.Items)
  472. }
  473. }*/
  474. numCommits := 0
  475. numForks := 0
  476. numMerges := 0
  477. numDeletes := 0
  478. processed := map[plumbing.Hash]bool{}
  479. for _, p := range plan {
  480. switch p.Action {
  481. case runActionCommit:
  482. processed[p.Commit.Hash] = true
  483. for _, parent := range p.Commit.ParentHashes {
  484. assert.Contains(t, processed, parent)
  485. }
  486. numCommits++
  487. case runActionFork:
  488. numForks++
  489. case runActionMerge:
  490. numMerges++
  491. case runActionDelete:
  492. numDeletes++
  493. }
  494. }
  495. assert.Equal(t, numCommits, len(commits)+testCase[3], fmt.Sprintf("commits %v", testCase))
  496. assert.Equal(t, numForks, testCase[4], fmt.Sprintf("forks %v", testCase))
  497. assert.Equal(t, numMerges, testCase[5], fmt.Sprintf("merges %v", testCase))
  498. assert.Equal(t, numDeletes, testCase[6], fmt.Sprintf("deletes %v", testCase))
  499. }()
  500. }
  501. }