Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugg CI for #334 #337

Merged
merged 5 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,16 +844,16 @@ func DefaultConsensusConfig() *ConsensusConfig {
// TestConsensusConfig returns a configuration for testing the consensus service
func TestConsensusConfig() *ConsensusConfig {
cfg := DefaultConsensusConfig()
cfg.TimeoutPropose = 40 * time.Millisecond
cfg.TimeoutProposeDelta = 1 * time.Millisecond
cfg.TimeoutPrevote = 10 * time.Millisecond
cfg.TimeoutPrevoteDelta = 1 * time.Millisecond
cfg.TimeoutPrecommit = 10 * time.Millisecond
cfg.TimeoutPrecommitDelta = 1 * time.Millisecond
cfg.TimeoutPropose = 100 * time.Millisecond
cfg.TimeoutProposeDelta = 10 * time.Millisecond
cfg.TimeoutPrevote = 40 * time.Millisecond
cfg.TimeoutPrevoteDelta = 10 * time.Millisecond
cfg.TimeoutPrecommit = 40 * time.Millisecond
cfg.TimeoutPrecommitDelta = 10 * time.Millisecond
// NOTE: when modifying, make sure to update time_iota_ms (testGenesisFmt) in toml.go
cfg.TimeoutCommit = 10 * time.Millisecond
cfg.TimeoutCommit = 40 * time.Millisecond
cfg.SkipTimeoutCommit = true
cfg.PeerGossipSleepDuration = 5 * time.Millisecond
cfg.PeerGossipSleepDuration = 10 * time.Millisecond
Comment on lines -847 to +856
Copy link
Member Author

@evan-forbes evan-forbes May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞 resorted to increasing the timeouts to get the consensus tests to be more reliable. Perhaps this is needed when github is busy?

I just kinda eyeballed these numbers. I have no reasoning for picking the ones I did.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's ok I think 👍🏻

cfg.PeerQueryMaj23SleepDuration = 250 * time.Millisecond
cfg.DoubleSignCheckHeight = int64(0)
return cfg
Expand Down
2 changes: 1 addition & 1 deletion consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type cleanupFunc func()
var (
config *cfg.Config // NOTE: must be reset for each _test.go file
consensusReplayConfig *cfg.Config
ensureTimeout = 600 * time.Millisecond
ensureTimeout = 1000 * time.Millisecond
)

func ensureDir(dir string, mode os.FileMode) {
Expand Down
7 changes: 7 additions & 0 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ func NewState(
//----------------------------------------
// Public interface

// SetIPFSApi sets the IPFSAPI
func (cs *State) SetIPFSApi(api ipfsapi.CoreAPI) {
cs.mtx.Lock()
defer cs.mtx.Unlock()
cs.IpfsAPI = api
}
Comment on lines +210 to +215
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

race detector complains if mutex is not used


// SetLogger implements Service.
func (cs *State) SetLogger(l log.Logger) {
cs.BaseService.Logger = l
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func (n *Node) OnStart() error {
if err != nil {
return fmt.Errorf("failed to get IPFS API: %w", err)
}
n.consensusState.IpfsAPI = n.ipfsAPI
n.consensusState.SetIPFSApi(n.ipfsAPI)

return nil
}
Expand Down
7 changes: 7 additions & 0 deletions p2p/ipld/racedetector/is_active.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package racedetector

var raceDetectorActive = false

func IsActive() bool {
return raceDetectorActive
}
Comment on lines +1 to +7
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why moving it to it's own package makes the CI happy, idk.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻‍♂️

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build race

package ipld
package racedetector

func init() {
raceDetectorActive = true
Expand Down
5 changes: 2 additions & 3 deletions p2p/ipld/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import (
"github.com/stretchr/testify/require"

"github.com/lazyledger/lazyledger-core/ipfs/plugin"
"github.com/lazyledger/lazyledger-core/p2p/ipld/racedetector"
"github.com/lazyledger/lazyledger-core/types"
)

var raceDetectorActive = false

func TestLeafPath(t *testing.T) {
type test struct {
name string
Expand Down Expand Up @@ -247,7 +246,7 @@ func TestRetrieveBlockData(t *testing.T) {
t.Run(fmt.Sprintf("%s size %d", tc.name, tc.squareSize), func(t *testing.T) {
// if we're using the race detector, skip some large tests due to time and
// concurrency constraints
if raceDetectorActive && tc.squareSize > 8 {
if racedetector.IsActive() && tc.squareSize > 8 {
t.Skip("Not running large test due to time and concurrency constraints while race detector is active.")
}

Expand Down