add a heartbeat's worth of delay before restoring mutated globals

the race detector cries on travis
This commit is contained in:
vyzo 2020-04-22 19:34:36 +03:00
parent 6d24f46a13
commit 6a230e711e
2 changed files with 7 additions and 1 deletions

View File

@ -321,6 +321,7 @@ func TestGossipsubAttackGRAFTDuringBackoff(t *testing.T) {
originalGossipSubPruneBackoffPenalty := GossipSubPruneBackoffPenalty
GossipSubPruneBackoffPenalty = 500 * time.Millisecond
defer func() {
time.Sleep(time.Second)
GossipSubPruneBackoff = originalGossipSubPruneBackoff
GossipSubPruneBackoffPenalty = originalGossipSubPruneBackoffPenalty
GossipSubGraftFloodThreshold = originalGossipSubGraftFloodThreshold

View File

@ -271,7 +271,10 @@ func TestGossipsubFanoutMaintenance(t *testing.T) {
func TestGossipsubFanoutExpiry(t *testing.T) {
GossipSubFanoutTTL = 1 * time.Second
defer func() { GossipSubFanoutTTL = 60 * time.Second }()
defer func() {
time.Sleep(time.Second)
GossipSubFanoutTTL = 60 * time.Second
}()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -997,6 +1000,7 @@ func TestGossipsubDirectPeers(t *testing.T) {
originalGossipSubDirectConnectTicks := GossipSubDirectConnectTicks
GossipSubDirectConnectTicks = 2
defer func() {
time.Sleep(time.Second)
GossipSubDirectConnectTicks = originalGossipSubDirectConnectTicks
}()
@ -1282,6 +1286,7 @@ func TestGossipsubOpportunisticGrafting(t *testing.T) {
originalGossipSubOpportunisticGraftTicks := GossipSubOpportunisticGraftTicks
GossipSubOpportunisticGraftTicks = 2
defer func() {
time.Sleep(time.Second)
GossipSubPruneBackoff = originalGossipSubPruneBackoff
GossipSubGraftFloodThreshold = originalGossipSubGraftFloodThreshold
GossipSubOpportunisticGraftTicks = originalGossipSubOpportunisticGraftTicks