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

Resolve #22: --unanimous will exit(0) and output nothing if all hosts agree. #35

Closed
wants to merge 2 commits into from

Conversation

dilijev
Copy link
Collaborator

@dilijev dilijev commented Aug 3, 2017

Otherwise, exit(1) and show output as usual.

Resolves #22

…l hosts agree.

Otherwise, exit(1) and show output as usual.

Resolves bterlson#22
@dilijev dilijev requested review from bterlson and rwaldron August 4, 2017 18:17
bin/eshost.js Outdated
@@ -45,6 +45,9 @@ const yargv = yargs
.describe('showSource', 'show input source')
.boolean('showSource')
.alias('showSource', 'i')
.describe('quorum', 'If all engines agree, exit(0) with no output, otherwise print and exit(1); implies --coalesce')
.boolean('quorum')
.alias('quorum', 'q')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this, but not sure about the naming. Maybe "unanimous"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, good point. That's more accurate to the intent anyway. Short form -u is also available.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Short form -u is also available.

Maybe it was meant to be!

@dilijev dilijev changed the title Resolve #22: --quorum will exit(0) and output nothing if all hosts agree. Resolve #22: --unanimous will exit(0) and output nothing if all hosts agree. Aug 4, 2017
Copy link
Owner

@bterlson bterlson left a comment

Choose a reason for hiding this comment

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

Needs tests, but otherwise very useful.

Copy link
Collaborator

@rwaldron rwaldron left a comment

Choose a reason for hiding this comment

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

As I was writing tests for this branch, I discovered the issues that I posted here. Instead of burdening @dilijev with the workload, I opted to resolve the issues myself, along with adding the necessary tests. I've moved our combined commits into a new PR.

@@ -34,4 +36,16 @@ module.exports = class Reporter {
]);
}
}

static addTo(hostName, result) {
table.push([
Copy link
Collaborator

Choose a reason for hiding this comment

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

table is undefined here. This can be fixed by changing the signature to match Reporter.coalesceInto(this.results, host, resultString, this.resultsMap, ", ");, ie. Reporter.addTo(this.results, host, resultString); and then addTo becomes:

  static addTo(table, host, result) {
    table.push([
      host.name, result
    ]);
  }

@@ -169,11 +178,10 @@ if (hosts.length === 0) {

let reporterOptions = {
showSource: argv.showSource,
coalesce: argv.coalesce
coalesce: argv.coalesce,
showSource: argv.showSource,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Duplicate key here.

@@ -72,6 +75,7 @@ const yargv = yargs
.example('eshost -h ch-*,node test.js')
.example('eshost -h ch-1.?.? test.js')
.example('eshost --tags latest test.js')
.example('eshost --unanimous test.js')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing -e or --eval

this.results.forEach(row => {
printHostResult(row[0], row[1]);
})
if (this.options.unanimous && this.results.length == 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand this logic, as the following results are unanimous, but would fail this check.

Given:

 eshost -u -e "1+1"

this.results might look like:

[ [ 'd8', '2' ], [ 'js', '2' ], [ 'ch', '2' ] ]

But that would fail this check and thus fail

If all engines under test produce identical output (logic already exists to test this in the collate option), print no output and set exit code to 0.

@rwaldron
Copy link
Collaborator

Combined here: #37

@rwaldron rwaldron closed this Aug 23, 2017
bterlson added a commit that referenced this pull request Aug 23, 2017
--unanimous tests (contains all commits from, and supersedes, #35)
@dilijev dilijev deleted the quorum branch August 23, 2017 19:08
@dilijev dilijev mentioned this pull request Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants