@@ -425,38 +425,52 @@ func (s *PublishedFileMissingSuite) TestIdenticalPackageRace(c *C) {
425425
426426 // Race: add and publish both simultaneously
427427 var wg sync.WaitGroup
428- wg .Add (4 )
428+ wg .Add (2 )
429429
430430 go func () {
431431 defer wg .Done ()
432- time .Sleep (5 * time .Millisecond )
432+ //time.Sleep(5 * time.Millisecond)
433+ c .Logf ("[iter %d] Import A" , iter )
433434 resp := s .httpRequest (c , "POST" , fmt .Sprintf ("/api/repos/%s/file/%s?noRemove=0" , repos [0 ], uploadID1 ), nil )
434435 c .Logf ("[iter %d] Import A complete: %d" , iter , resp .Code )
435- }()
436-
437- go func () {
438- defer wg .Done ()
439- time .Sleep (7 * time .Millisecond )
440- resp := s .httpRequest (c , "POST" , fmt .Sprintf ("/api/repos/%s/file/%s?noRemove=0" , repos [1 ], uploadID2 ), nil )
441- c .Logf ("[iter %d] Import B complete: %d" , iter , resp .Code )
442- }()
443436
444- go func () {
445- defer wg .Done ()
446- time .Sleep (15 * time .Millisecond )
447437 updateBody , _ := json .Marshal (gin.H {"Signing" : gin.H {"Skip" : true }, "ForceOverwrite" : true , "SkipBz2" : true })
448- resp := s .httpRequest (c , "PUT" , fmt .Sprintf ("/api/publish/identical/%s" , dists [0 ]), updateBody )
438+ c .Logf ("[iter %d] Publish A" , iter )
439+ resp = s .httpRequest (c , "PUT" , fmt .Sprintf ("/api/publish/identical/%s" , dists [0 ]), updateBody )
449440 c .Logf ("[iter %d] Publish A complete: %d" , iter , resp .Code )
450441 }()
451442
452443 go func () {
453444 defer wg .Done ()
454- time .Sleep (18 * time .Millisecond )
445+ //time.Sleep(7 * time.Millisecond)
446+ c .Logf ("[iter %d] Import B" , iter )
447+ resp := s .httpRequest (c , "POST" , fmt .Sprintf ("/api/repos/%s/file/%s?noRemove=0" , repos [1 ], uploadID2 ), nil )
448+ c .Logf ("[iter %d] Import B complete: %d" , iter , resp .Code )
449+
455450 updateBody , _ := json .Marshal (gin.H {"Signing" : gin.H {"Skip" : true }, "ForceOverwrite" : true , "SkipBz2" : true })
456- resp := s .httpRequest (c , "PUT" , fmt .Sprintf ("/api/publish/identical/%s" , dists [1 ]), updateBody )
451+ c .Logf ("[iter %d] Publish B" , iter )
452+ resp = s .httpRequest (c , "PUT" , fmt .Sprintf ("/api/publish/identical/%s" , dists [1 ]), updateBody )
457453 c .Logf ("[iter %d] Publish B complete: %d" , iter , resp .Code )
458454 }()
459455
456+ //go func() {
457+ //defer wg.Done()
458+ //time.Sleep(15 * time.Millisecond)
459+ //updateBody, _ := json.Marshal(gin.H{"Signing": gin.H{"Skip": true}, "ForceOverwrite": true, "SkipBz2": true})
460+ //c.Logf("[iter %d] Publish A", iter)
461+ //resp := s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/identical/%s", dists[0]), updateBody)
462+ //c.Logf("[iter %d] Publish A complete: %d", iter, resp.Code)
463+ //}()
464+
465+ //go func() {
466+ //defer wg.Done()
467+ //time.Sleep(18 * time.Millisecond)
468+ //updateBody, _ := json.Marshal(gin.H{"Signing": gin.H{"Skip": true}, "ForceOverwrite": true, "SkipBz2": true})
469+ //c.Logf("[iter %d] Publish B", iter)
470+ //resp := s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/identical/%s", dists[1]), updateBody)
471+ //c.Logf("[iter %d] Publish B complete: %d", iter, resp.Code)
472+ //}()
473+
460474 wg .Wait ()
461475 time .Sleep (200 * time .Millisecond )
462476 c .Logf ("[iter %d] All operations complete" , iter )
0 commit comments