<commit_before>require 'json'
require 'net/http'

require 'support/test_case'

case_pattern = $base_dir.join('integration', 'cases', '*.rb')
Dir[case_pattern].each do |use_case|
  require use_case
end

# Base class for EC2 integration tests
class IntegrationTest < TestCase
  include Loggable

  # Returns a name for the current test's server
  # that should be fairly unique.
  def server_name
    "knife_solo-#{image_id}"
  end

  # Shortcut to access the test runner
  def runner
    MiniTest::Unit.runner
  end

  # Returns the server for this test, retrieved from the test runner
  def server
    return @server if @server
    @server = runner.get_server(self)
  end

  # The flavor to run this test on
  def flavor_id
    "m1.small"
  end

  # Sets up a kitchen directory to work in
  def setup
    @kitchen = $base_dir.join('support', 'kitchens', self.class.to_s)
    @kitchen.dirname.mkpath
    system "knife kitchen #{@kitchen} >> #{log_file}"
    @start_dir = Dir.pwd
    Dir.chdir(@kitchen)
    prepare_server
  end

  # Removes the test kitchen
  def teardown
    Dir.chdir(@start_dir)
    FileUtils.remove_entry_secure(@kitchen)<commit_msg>Avoid kitchens hanging around after test cancelation<commit_after>require 'json'
require 'net/http'

require 'support/test_case'

case_pattern = $base_dir.join('integration', 'cases', '*.rb')
Dir[case_pattern].each do |use_case|
  require use_case
end

# Base class for EC2 integration tests
class IntegrationTest < TestCase
  include Loggable

  # Returns a name for the current test's server
  # that should be fairly unique.
  def server_name
    "knife_solo-#{image_id}"
  end

  # Shortcut to access the test runner
  def runner
    MiniTest::Unit.runner
  end

  # Returns the server for this test, retrieved from the test runner
  def server
    return @server if @server
    @server = runner.get_server(self)
  end

  # The flavor to run this test on
  def flavor_id
    "m1.small"
  end

  # Sets up a kitchen directory to work in
  def setup
    @kitchen = $base_dir.join('support', 'kitchens', self.class.to_s)
    FileUtils.remove_entry_secure(@kitchen, true)
    @kitchen.dirname.mkpath
    system "knife kitchen #{@kitchen} >> #{log_file}"
    @start_dir = Dir.pwd
    Dir.chdir(@kitchen)
    prepare_server
  end

  # Gets back to the start dir
  def teardown
    Dir.chdir(@start_dir)
{'fraction_non_alphanumeric': 0.08967275818104548, 'fraction_numerical': 0.0016999575010624734, 'mean_word_length': 3.59765625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2248419', 'n_tokens_mistral': 781, 'n_tokens_neox': 763, 'n_words': 244}