tests: tune flaky tests that error in travis occasionally (#18508)
* tests: tune flaky tests that error in travis occasionally * tests: formatting
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							a50b471b6b
						
					
				
				
					commit
					dc43ea8d03
				
			@@ -244,7 +244,7 @@ func verifyImportEvent(t *testing.T, imported chan *types.Block, arrive bool) {
 | 
				
			|||||||
		select {
 | 
							select {
 | 
				
			||||||
		case <-imported:
 | 
							case <-imported:
 | 
				
			||||||
			t.Fatalf("import invoked")
 | 
								t.Fatalf("import invoked")
 | 
				
			||||||
		case <-time.After(10 * time.Millisecond):
 | 
							case <-time.After(20 * time.Millisecond):
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -224,7 +224,7 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
 | 
				
			|||||||
	for i := 0; i < 2; i += 1 {
 | 
						for i := 0; i < 2; i += 1 {
 | 
				
			||||||
		select {
 | 
							select {
 | 
				
			||||||
		case <-taskCh:
 | 
							case <-taskCh:
 | 
				
			||||||
		case <-time.NewTimer(time.Second).C:
 | 
							case <-time.NewTimer(2 * time.Second).C:
 | 
				
			||||||
			t.Error("new task timeout")
 | 
								t.Error("new task timeout")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -269,8 +269,11 @@ func TestProtocolHook(t *testing.T) {
 | 
				
			|||||||
	if !testHook.send {
 | 
						if !testHook.send {
 | 
				
			||||||
		t.Fatal("Expected a send message, but it is not")
 | 
							t.Fatal("Expected a send message, but it is not")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if testHook.peer == nil || testHook.peer.ID() != tester.Nodes[0].ID() {
 | 
						if testHook.peer == nil {
 | 
				
			||||||
		t.Fatal("Expected peer ID to be set correctly, but it is not")
 | 
							t.Fatal("Expected peer to be set, is nil")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if peerId := testHook.peer.ID(); peerId != tester.Nodes[0].ID() && peerId != tester.Nodes[1].ID() {
 | 
				
			||||||
 | 
							t.Fatalf("Expected peer ID to be set correctly, but it is not (got %v, exp %v or %v", peerId, tester.Nodes[0].ID(), tester.Nodes[1].ID())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if testHook.size != 11 { //11 is the length of the encoded message
 | 
						if testHook.size != 11 { //11 is the length of the encoded message
 | 
				
			||||||
		t.Fatalf("Expected size to be %d, but it is %d ", 1, testHook.size)
 | 
							t.Fatalf("Expected size to be %d, but it is %d ", 1, testHook.size)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ func TestReporter(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	//setup the metrics
 | 
						//setup the metrics
 | 
				
			||||||
	log.Debug("Setting up metrics first time")
 | 
						log.Debug("Setting up metrics first time")
 | 
				
			||||||
	reportInterval := 5 * time.Millisecond
 | 
						reportInterval := 2 * time.Millisecond
 | 
				
			||||||
	metrics := SetupAccountingMetrics(reportInterval, filepath.Join(dir, "test.db"))
 | 
						metrics := SetupAccountingMetrics(reportInterval, filepath.Join(dir, "test.db"))
 | 
				
			||||||
	log.Debug("Done.")
 | 
						log.Debug("Done.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user