<commit_before>require 'spec_helper'
require_relative '../lib/stubs/aws_stubs'

describe 'Node' do
  include Smash::CloudPowers::AwsStubs
  include Smash::CloudPowers::AwsResources
  include Smash::CloudPowers::Helper
  include Smash::CloudPowers::Node
  include Smash::CloudPowers::Zenv

  before(:all) do
    Dotenv.load("#{project_root}/.test.env.example")
    @config = Smash::CloudPowers::AwsStubs.node_stub.merge(max_count: 5)
  end

  before(:each) do
    @ec2 = ec2(@config) # ec2 is now stubbed and cached
  end

  context('#spin_up_neurons') do
    it 'should be able to start n number of nodes' do
      expect(spin_up_neurons.count).to eql(5)
    end
  end

  context('#batch_tags') do
    it 'should be able to add or overwrite tags to resources' do
      ids = @config[:stub_responses][:describe_instances][:reservations].first[:instances].map { |f| f[:instance_id] }
      tags = Smash::CloudPowers::AwsStubs.instance_tags_stub[:tags]
      expect(create_tags(ids, tags)).not_to be_nil
    end
  end

  it '#node_config should have a valid default Hash for starting nodes' do
    expect(node_config).to be_kind_of(Hash)
  end
end
<commit_msg>suggested fix for failing spec in batch_tags() addition<commit_after>require 'spec_helper'
require_relative '../lib/stubs/aws_stubs'

describe 'Node' do
  include Smash::CloudPowers::AwsStubs
  include Smash::CloudPowers::AwsResources
  include Smash::CloudPowers::Helper
  include Smash::CloudPowers::Node
  include Smash::CloudPowers::Zenv

  before(:all) do
    Dotenv.load("#{project_root}/.test.env.example")
    @config = Smash::CloudPowers::AwsStubs.node_stub.merge(max_count: 5)
  end

  before(:each) do
    @ec2 = ec2(@config) # ec2 is now stubbed and cached
  end

  context('#spin_up_neurons') do
    it 'should be able to start n number of nodes' do
      expect(spin_up_neurons.count).to eql(5)
    end
  end

  context('#batch_tag') do
    it 'should be able to add or overwrite tags to resources' do
      ids = @config[:stub_responses][:describe_instances][:reservations].first[:instances].map { |f| f[:instance_id] }
      tags = Smash::CloudPowers::AwsStubs.instance_tags_stub[:tags]
      expect(batch_tag(ids, tags)).not_to be_nil
    end
  end

  it '#node_config should have a valid default Hash for starting nodes' do
    expect(node_config).to be_kind_of(Hash)
  end
end

{'fraction_non_alphanumeric': 0.1155971100722482, 'fraction_numerical': 0.004249893752656183, 'mean_word_length': 4.474418604651163, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1308817', 'n_tokens_mistral': 829, 'n_tokens_neox': 799, 'n_words': 193}