<commit_before>require 'serverspec'
require 'net/ssh'

set :backend, :ssh

if ENV['ASK_SUDO_PASSWORD']
  begin
    require 'highline/import'
  rescue LoadError
    fail "highline is not available. Try installing it."
  end
  set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
else
  set :sudo_password, ENV['<PASSWORD>']
end

options = Net::SSH::Config.for(host)
options[:user] ||= Etc.getlogin

if ENV['ASK_LOGIN_PASSWORD']
  options[:password] = ask("\nEnter login password: ") { |q| q.echo = false }
else
  options[:password] = ENV['LOGIN_PASSWORD']
end

host = ENV['TARGET_HOST']

set :host,        options[:host_name] || host
set :ssh_options, options

# Disable sudo
# set :disable_sudo, true

# Set environment variables
# set :env, :LANG => 'C', :LC_MESSAGES => 'C' 

# Set PATH
# set :path, '/sbin:/usr/local/sbin:$PATH'

class TestConfig
  attr_reader :target, :topology

  def initialize(target, topology)
    @target = target.downcase
    @topology = topology.downcase
  end
end

@tc = TestConfig.new(ENV['TARGET_HOST'] || 'unknown', ENV['TOPOLOGY'] || '1s')

def target
  @tc.target
end

def topology
  @tc.topology
end

def spine?
  @tc.target.start_with? 'spine'
end

def leaf?
  @tc.target.start_with? 'leaf'
end

def server?
  @tc.target.start_with? 'server'
end

puts "Target is #{target} and topology is #{topology}"<commit_msg>adding wbench target to spec_helper<commit_after>require 'serverspec'
require 'net/ssh'

set :backend, :ssh

if ENV['ASK_SUDO_PASSWORD']
  begin
    require 'highline/import'
  rescue LoadError
    fail "highline is not available. Try installing it."
  end
  set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
else
  set :sudo_password, ENV['<PASSWORD>']
end

options = Net::SSH::Config.for(host)
options[:user] ||= Etc.getlogin

if ENV['ASK_LOGIN_PASSWORD']
  options[:password] = ask("\nEnter login password: ") { |q| q.echo = false }
else
  options[:password] = ENV['LOGIN_PASSWORD']
end

host = ENV['TARGET_HOST']

set :host,        options[:host_name] || host
set :ssh_options, options

# Disable sudo
# set :disable_sudo, true

# Set environment variables
# set :env, :LANG => 'C', :LC_MESSAGES => 'C' 

# Set PATH
# set :path, '/sbin:/usr/local/sbin:$PATH'

class TestConfig
  attr_reader :target, :topology

  def initialize(target, topology)
    @target = target.downcase
    @topology = topology.downcase
  end
end

@tc = TestConfig.new(ENV['TARGET_HOST'] || 'unknown', ENV['TOPOLOGY'] || '1s')

def target
  @tc.target
end

def topology
  @tc.topology
end

def spine?
  @tc.target.start_with? 'spine'
end

def leaf?
  @tc.target.start_with? 'leaf'
end

def server?
  @tc.target.start_with? 'server'
end

def wbench?
  @tc.target.start_with? 'wbench'
end

puts "Target is #{target} and topology is #{topology}"
{'fraction_non_alphanumeric': 0.14417942328230687, 'fraction_numerical': 0.000711997152011392, 'mean_word_length': 4.393474088291747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1636028', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1022, 'n_words': 270}