Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ssmirr committed May 6, 2019
2 parents 80256b1 + 7a4429d commit 032ef88
Show file tree
Hide file tree
Showing 5 changed files with 1,730 additions and 1,174 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

# [0.4.0](https://github.com/ottomatica/opunit/compare/v0.3.2...v0.4.0) (2019-05-06)


### Bug Fixes

* Fix reachable check for directories ([8f3e812](https://github.com/ottomatica/opunit/commit/8f3e812))
* **checks:** Fixes conditional statement in reachable check ([2aaf6c7](https://github.com/ottomatica/opunit/commit/2aaf6c7))
* **checks:** reachable check should use status of last redirect ([5b83f98](https://github.com/ottomatica/opunit/commit/5b83f98))
* **reachable:** parses redirected headers and searches for 200 ok ([#80](https://github.com/ottomatica/opunit/issues/80)) ([35e986d](https://github.com/ottomatica/opunit/commit/35e986d))


### Features

* Exit code = 1 when any checks fail ([50fb273](https://github.com/ottomatica/opunit/commit/50fb273))



<a name="0.3.2"></a>
## [0.3.2](https://github.com/ottomatica/opunit/compare/v0.3.1...v0.3.2) (2019-02-07)

Expand Down
7 changes: 4 additions & 3 deletions lib/harness/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,17 @@ class SSHConnector {

async isReachable(host, context) {
let output = (await this.exec(context, `ping -c 3 ${host}`));
if (!(output.includes('nknown host') || output.includes('cannot resolve'))) {
if (!(output.includes('nknown host') || !output.includes('cannot resolve'))) {
// Domain checks out
return true;
}
// Url is reachable
return (await this.exec(context, `curl -Is ${host} | head -1`)).includes('200 OK');
// See: https://stackoverflow.com/questions/10060098/getting-only-response-header-from-http-post-using-curl , https://stackoverflow.com/questions/47080853/show-the-final-redirect-headers-using-curl
return (await this.exec(context, `curl -sL -D - ${host} -o /dev/null | grep 'HTTP/1.1' | tail -1`)).includes('200 OK');
}

async pathExists(path, context) {
return (await this.exec(context, `[ ! -f ${path} ] || echo 'file exists'`)).includes('file exists');
return (await this.exec(context, `[ ! -e ${path} ] || echo 'file exists'`)).includes('file exists');
}

async contains(context, file, string, expect = true) {
Expand Down
4 changes: 4 additions & 0 deletions lib/inspect/report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

const chalk = require('chalk');
const process = require('process');
const os = require('os');

class Reporter {
Expand Down Expand Up @@ -27,6 +28,9 @@ class Reporter {
} else {
let overallPassRate = (this.passed / this.total * 100.0).toFixed(1);

// set exitCode to 1 if anything failed
if (this.failed > 0) process.exitCode = 1;

console.log();
console.log(chalk.underline('Summary'));
console.log();
Expand Down
Loading

0 comments on commit 032ef88

Please sign in to comment.