<commit_before>require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper.rb'))

describe TestbotCloud::Server::AWS, "bootstrap!" do<commit_msg>Basic tests for the ec2 adapter.<commit_after>require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper.rb'))

describe TestbotCloud::Server::AWS, "bootstrap!" do

  it "should upload bootstrap files and run them" do
    fog_server = mock(Object, :dns_name => "server.somewhere.ec2", :id => "i-aaa")
    server = TestbotCloud::Server::AWS.new(nil, fog_server)
    
    server.should_receive(:system).and_return(true)
    server.should_receive(:system).with("scp -o StrictHostKeyChecking=no -i testbot.pem -r bootstrap ubuntu@server.somewhere.ec2:~ &> /dev/null").and_return(true)
    server.should_receive(:system).with("ssh -o StrictHostKeyChecking=no -i testbot.pem ubuntu@server.somewhere.ec2 'cd bootstrap; sudo sh runner.sh' &> /dev/null")

    server.stub!(:sleep)
    server.bootstrap!(Mutex.new)
  end

{'fraction_non_alphanumeric': 0.1529888551165147, 'fraction_numerical': 0.004052684903748734, 'mean_word_length': 5.415584415584416, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4976018', 'n_tokens_mistral': 344, 'n_tokens_neox': 329, 'n_words': 61}