mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
moving log checks (#509)
This commit is contained in:
committed by
terence tsao
parent
a630abae59
commit
9aced5f145
@@ -46,8 +46,9 @@ func TestLifecycle(t *testing.T) {
|
||||
}
|
||||
att := NewAttester(context.Background(), cfg)
|
||||
att.Start()
|
||||
testutil.AssertLogsContain(t, hook, "Starting service")
|
||||
att.Stop()
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Starting service")
|
||||
testutil.AssertLogsContain(t, hook, "Stopping service")
|
||||
}
|
||||
|
||||
@@ -77,9 +78,11 @@ func TestAttesterLoop(t *testing.T) {
|
||||
<-exitRoutine
|
||||
}()
|
||||
att.assignmentChan <- &pbp2p.BeaconBlock{SlotNumber: 33}
|
||||
testutil.AssertLogsContain(t, hook, "Performing attester responsibility")
|
||||
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Performing attester responsibility")
|
||||
testutil.AssertLogsContain(t, hook, "Attester context closed")
|
||||
}
|
||||
|
||||
@@ -104,9 +107,10 @@ func TestAttesterMarshalError(t *testing.T) {
|
||||
}()
|
||||
|
||||
p.assignmentChan <- nil
|
||||
testutil.AssertLogsContain(t, hook, "Could not marshal latest beacon block")
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Could not marshal latest beacon block")
|
||||
testutil.AssertLogsContain(t, hook, "Attester context closed")
|
||||
}
|
||||
|
||||
@@ -137,9 +141,10 @@ func TestAttesterErrorLoop(t *testing.T) {
|
||||
}()
|
||||
|
||||
p.assignmentChan <- &pbp2p.BeaconBlock{SlotNumber: 999}
|
||||
testutil.AssertLogsContain(t, hook, "Performing attester responsibility")
|
||||
testutil.AssertLogsContain(t, hook, "could not attest head")
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Performing attester responsibility")
|
||||
testutil.AssertLogsContain(t, hook, "could not attest head")
|
||||
testutil.AssertLogsContain(t, hook, "Attester context closed")
|
||||
}
|
||||
|
||||
@@ -47,8 +47,9 @@ func TestLifecycle(t *testing.T) {
|
||||
}
|
||||
p := NewProposer(context.Background(), cfg)
|
||||
p.Start()
|
||||
testutil.AssertLogsContain(t, hook, "Starting service")
|
||||
p.Stop()
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Starting service")
|
||||
testutil.AssertLogsContain(t, hook, "Stopping service")
|
||||
}
|
||||
|
||||
@@ -80,10 +81,11 @@ func TestProposerLoop(t *testing.T) {
|
||||
<-exitRoutine
|
||||
}()
|
||||
p.assignmentChan <- &pbp2p.BeaconBlock{SlotNumber: 5}
|
||||
testutil.AssertLogsContain(t, hook, "Performing proposer responsibility")
|
||||
testutil.AssertLogsContain(t, hook, fmt.Sprintf("Block proposed successfully with hash 0x%x", []byte("hi")))
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Performing proposer responsibility")
|
||||
testutil.AssertLogsContain(t, hook, fmt.Sprintf("Block proposed successfully with hash 0x%x", []byte("hi")))
|
||||
testutil.AssertLogsContain(t, hook, "Proposer context closed")
|
||||
}
|
||||
|
||||
@@ -108,9 +110,10 @@ func TestProposerMarshalError(t *testing.T) {
|
||||
}()
|
||||
|
||||
p.assignmentChan <- nil
|
||||
testutil.AssertLogsContain(t, hook, "Could not marshal latest beacon block")
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Could not marshal latest beacon block")
|
||||
testutil.AssertLogsContain(t, hook, "Proposer context closed")
|
||||
}
|
||||
|
||||
@@ -141,9 +144,10 @@ func TestProposerErrorLoop(t *testing.T) {
|
||||
}()
|
||||
|
||||
p.assignmentChan <- &pbp2p.BeaconBlock{SlotNumber: 5}
|
||||
testutil.AssertLogsContain(t, hook, "Performing proposer responsibility")
|
||||
testutil.AssertLogsContain(t, hook, "bad block proposed")
|
||||
doneChan <- struct{}{}
|
||||
exitRoutine <- true
|
||||
|
||||
testutil.AssertLogsContain(t, hook, "Performing proposer responsibility")
|
||||
testutil.AssertLogsContain(t, hook, "bad block proposed")
|
||||
testutil.AssertLogsContain(t, hook, "Proposer context closed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user