Skip to content

Commit

Permalink
Merge pull request #12 from qu0b/improve/logging
Browse files Browse the repository at this point in the history
Improve logging
  • Loading branch information
pk910 authored Feb 29, 2024
2 parents 6444253 + d1c64b2 commit bbfb4b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ func (stream *Stream) receiveEvents(r io.ReadCloser) {
return
}

stream.closeMutex.Unlock()

pub, ok := ev.(StreamEvent)
if !ok {
stream.closeMutex.Unlock()
continue
}

Expand All @@ -204,6 +203,7 @@ func (stream *Stream) receiveEvents(r io.ReadCloser) {
}

stream.Events <- pub
stream.closeMutex.Unlock()
}
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/coordinator/tasks/check_consensus_forks/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ func (t *Task) runCheck() types.TaskResult {
t.logger.Warnf("check failed: too many forks. (have: %v, want <= %v)", len(headForks)-1, t.config.MaxForkCount)

for idx, fork := range headForks {
t.logger.Infof("Fork #%v: %v [0x%x] (%v clients)", idx, fork.Slot, fork.Root, len(fork.AllClients))
clients := make([]string, len(fork.AllClients))
for _, client := range fork.AllClients {
clients = append(clients, client.GetName())
}

t.logger.Infof("Fork #%v: %v [0x%x] (%v clients: [%v])", idx, fork.Slot, fork.Root, len(fork.AllClients), clients)
}

return types.TaskResultFailure
Expand Down
4 changes: 4 additions & 0 deletions pkg/coordinator/test/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func LoadTestDescriptors(ctx context.Context, localTests []*types.TestConfig, ex

testConfig, err := LoadExternalTestConfig(ctx, extTestCfg)

if testConfig.ID != "" {
testID = testConfig.ID
}

if testID == "" {
testID = fmt.Sprintf("external-%v", testIdx)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/coordinator/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Test struct {
func CreateTest(runID uint64, descriptor types.TestDescriptor, logger logrus.FieldLogger, services types.TaskServices, variables types.Variables) (types.Test, error) {
test := &Test{
runID: runID,
logger: logger.WithField("RunID", runID),
logger: logger.WithField("RunID", runID).WithField("TestID", descriptor.ID()),
descriptor: descriptor,
config: descriptor.Config(),
status: types.TestStatusPending,
Expand Down Expand Up @@ -167,6 +167,7 @@ func (t *Test) Run(ctx context.Context) error {
}

func (t *Test) AbortTest(skipCleanup bool) {
t.logger.Info("aborting test")
t.status = types.TestStatusAborted

if t.taskScheduler != nil {
Expand Down

0 comments on commit bbfb4b5

Please sign in to comment.