Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

strongloop / node-foreman / 230

8 May 2016 - 19:54 coverage: 88.64%. First build
230

Pull #117

travis-ci

8bd1dd86bbf8705a5a702b86a2f3a390?size=18&default=identiconrmg
proxy: add tests for multi-proxy behaviour

The test setup is based on the behaviour described in #93, but with the
required modifications to support testing without using any fixed ports.
Pull Request #117: WIP: Upgrade all outdated dependencies

43 of 51 new or added lines in 6 files covered. (84.31%)

554 of 625 relevant lines covered (88.64%)

92.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.48
/lib/forward.js
1
// Copyright IBM Corp. 2012,2016. All Rights Reserved.
2
// Node module: foreman
3
// This file is licensed under the MIT License.
4
// License text available at https://opensource.org/licenses/MIT
5

6
var prog = require('child_process');
75×
7

8
var cons = require('./console').Console;
75×
9

10
function startForward(port, hostname, emitter) {
75×
11
  var proc = prog.fork(__dirname + '/../forward.js', [], {
5×
12
    env: {
13
      PROXY_PORT: port,
14
      PROXY_HOST: hostname || '<ANY>'
15
    }
16
  });
17
  cons.Alert('Forward Proxy Started in Port %d', port);
5×
18
  if(hostname) {
5×
19
    cons.Alert('Intercepting requests to %s through forward proxy', hostname);
5×
20
  } else {
21
    cons.Alert('Intercepting ALL requests through forward proxy');
!
22
  }
23
  proc.on('message', function(msg) {
5×
24
    if ('http' in msg) {
5×
25
      cons.Alert('Forward Proxy Listening On Port %d', msg.http);
5×
26
      emitter.emit('http', msg.http);
5×
27
    }
28
  });
29
  emitter.once('killall', function(signal) {
5×
30
    cons.Done('Killing Forward Proxy Server on Port %d',port);
5×
31
    try {
5×
32
      proc.disconnect();
5×
33
      proc.kill(signal);
5×
34
    } catch(_e) {
NEW
35
      cons.Warn('Proxy server already dead');
!
36
    }
37
  });
38

39
  proc.on('exit', function(code, signal) {
5×
40
    emitter.emit('killall', 'SIGINT');
5×
41
  });
42
}
43

44
module.exports.startForward = startForward;
75×
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc