Skip to content

Commit

Permalink
chore: more testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ilikejames committed Feb 25, 2023
1 parent 74df20b commit e05abe3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/leader/src/ElectionSvc/ElectionSvc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ export class ElectionSvc {
}

private countVotes() {
this.logger?.debug(loggerName, 'counting votes', JSON.stringify(this.votes))

const result = voteCounter(this.instanceId, this.votes)
this.electionTimerId = null
this.hasVoted = false
this.votes.clear()
this.logger?.debug(loggerName, 'Election results', result)
this.logger?.debug(loggerName, 'Election results', JSON.stringify(result))
// Do we need to ensure all agree on the outcome?
this.events.next({ type: ElectionSvcEventTypes.Complete, payload: result })
}
Expand Down
10 changes: 5 additions & 5 deletions packages/test-e2e/src/leadership.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test.describe.parallel('leadership', () => {
instances.forEach((instance, i) => {
logs.set(tabNames[i], [])
instance.on('console', msg => {
log.debug('console', tabNames[i], msg.text())
log.debug('console-' + tabNames[i], msg.text())
logs.get(tabNames[i])!.push(msg.text())
})
})
Expand Down Expand Up @@ -173,10 +173,10 @@ test.describe.parallel('leadership', () => {
expect(followerTabs).toHaveLength(afterInstances.length - 1)
followerTabs.every(f => expect(f.leader).toEqual(newLeaderTab.iam))
} catch (e) {
log.debug('ERROR')
logs.forEach((logs, name) => {
log.debug(name, JSON.stringify(logs))
})
// log.debug('ERROR')
// logs.forEach((logs, name) => {
// log.debug(name, JSON.stringify(logs))
// })
throw e
}
})
Expand Down

0 comments on commit e05abe3

Please sign in to comment.