<commit_before>require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
require 'socket'

class NeverListenTest < Test::Unit::TestCase

  include LaunchableRoleTests

  def setup
    @object = Bane::Services::NeverListen.make(IRRELEVANT_PORT, Bane::Services::DEFAULT_HOST)
  end

  def test_never_connects
    service = Bane::Services::NeverListen.make(port, Bane::Services::DEFAULT_HOST)
    service.stdlog = StringIO.new
    service.start

    assert_times_out {
      TCPSocket.new('localhost', port)
    }
  ensure
    service.stop
  end

  def port
    4001
  end

end<commit_msg>Test that a socket connection is refused.<commit_after>require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
require 'socket'

class NeverListenTest < Test::Unit::TestCase

  include LaunchableRoleTests

  def setup
    @object = Bane::Services::NeverListen.make(IRRELEVANT_PORT, Bane::Services::DEFAULT_HOST)
  end

  def test_never_connects
    service = Bane::Services::NeverListen.make(port, Bane::Services::DEFAULT_HOST)
    service.stdlog = StringIO.new
    service.start

    assert_raise(Errno::ECONNREFUSED) {
      TCPSocket.new('localhost', port)
    }
  ensure
    service.stop
  end

  def port
    4001
  end

end
{'fraction_non_alphanumeric': 0.10573042776432606, 'fraction_numerical': 0.00645682001614205, 'mean_word_length': 4.2100840336134455, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4638208', 'n_tokens_mistral': 409, 'n_tokens_neox': 391, 'n_words': 75}