<commit_before>var test = require('tape')
var numock = require('numbat-collector-mock')
var requireInject = require('require-inject')
var ee = require('events').EventEmitter

// load numbat-emiter so it can connect to numock.
require('numbat-emitter')

var TARGET_PORT = 9998
var ANALYZER_PORT = 10000


test("net timeout",function(t){

  // now make a producer with broken network.
  var Producer = requireInject('../index.js',{
    'net':{
      connect:function(){
        var e = new ee()
        e.destroy = function(){}
        e.write = function(){
          console.log('write =(')
        }
        return e
      }    
    }
  })

  Producer.setDefaultTimeout(10)
  
  var collector = numock(ANALYZER_PORT)

  stopProducer = Producer({
    uri: 'tcp://127.0.0.1:' + ANALYZER_PORT,
    hosts: [
      'tcp://127.0.0.1:' + TARGET_PORT
    ],
    interval: 100
  })

  collector.once('data',function(){
    stopProducer()
    collector.finished(function(err,metrics){

      console.log(metrics)
      t.equals(metrics[0].name,'reachability','should have correct name')
      t.equals(metrics[0].value,0,'should not be reachable')

      t.end()
    })
  })
  
})
<commit_msg>log cleanup<commit_after>var test = require('tape')
var numock = require('numbat-collector-mock')
var requireInject = require('require-inject')
var ee = require('events').EventEmitter

// load numbat-emiter so it can connect to numock.
require('numbat-emitter')

var TARGET_PORT = 9998
var ANALYZER_PORT = 10000


test("net timeout",function(t){

  // now make a producer with broken network.
  var Producer = requireInject('../index.js',{
    'net':{
      connect:function(){
        var e = new ee()
        e.destroy = function(){}
        e.write = function(){
        }
        return e
      }    
    }
  })

  Producer.setDefaultTimeout(10)
  
  var collector = numock(ANALYZER_PORT)

  stopProducer = Producer({
    uri: 'tcp://127.0.0.1:' + ANALYZER_PORT,
    hosts: [
      'tcp://127.0.0.1:' + TARGET_PORT
    ],
    interval: 100
  })

  collector.once('data',function(){
    stopProducer()
    collector.finished(function(err,metrics){

      t.equals(metrics[0].name,'reachability','should have correct name')
      t.equals(metrics[0].value,0,'should not be reachable')

      t.end()
    })
  })
  
})

{'fraction_non_alphanumeric': 0.1519756838905775, 'fraction_numerical': 0.02518454190186713, 'mean_word_length': 2.8336106489184694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5183695', 'n_tokens_mistral': 818, 'n_tokens_neox': 775, 'n_words': 157}