<commit_before>require 'rubygems'
require 'rest_client'
require 'pp'
require 'json'
require 'awesome_print'

STDOUT.sync = true

shared_context "Stage" do |dtk_common|
  it "stages assembly from assembly template" do
    $assembly_id = dtk_common.stage_assembly()    
    $assembly_id.should eq(nil)
    puts "Stage completed successfully!"
  end
end

shared_context "List assemblies after stage" do |dtk_common|
  unless $assembly_id.nil?
    it "has staged assembly in assembly list" do
      assembly_exists = dtk_common.check_if_assembly_exists($assembly_id)
      assembly_exists.should eq(true)
      puts "Assembly exists in assembly list."
    end
  end
end

shared_context "Converge" do |dtk_common|
  unless $assembly_id.nil?
    it "converges assembly" do
      converge = dtk_common.converge_assembly($assembly_id)
      converge.should eq("succeeded")
      puts "Assembly converged successfully!"
    end
  end
end

shared_context "Check if port avaliable" do |dtk_common, port|
  unless $assembly_id.nil?
    it "exists" do
      netstat_response = dtk_common.netstats_check($assembly_id)
      namenode_port = netstat_response['data']['results'].select { |x| x['port'] == port}.first['port']
      namenode_port.should eq(port)<commit_msg>Fix stage assembly test<commit_after>require 'rubygems'
require 'rest_client'
require 'pp'
require 'json'
require 'awesome_print'

STDOUT.sync = true

shared_context "Stage" do |dtk_common|
  it "stages assembly from assembly template" do
    $assembly_id = dtk_common.stage_assembly()    
    $assembly_id.should_not eq(nil)
    puts "Stage completed successfully!"
  end
end

shared_context "List assemblies after stage" do |dtk_common|
  unless $assembly_id.nil?
    it "has staged assembly in assembly list" do
      assembly_exists = dtk_common.check_if_assembly_exists($assembly_id)
      assembly_exists.should eq(true)
      puts "Assembly exists in assembly list."
    end
  end
end

shared_context "Converge" do |dtk_common|
  unless $assembly_id.nil?
    it "converges assembly" do
      converge = dtk_common.converge_assembly($assembly_id)
      converge.should eq("succeeded")
      puts "Assembly converged successfully!"
    end
  end
end

shared_context "Check if port avaliable" do |dtk_common, port|
  unless $assembly_id.nil?
    it "exists" do
      netstat_response = dtk_common.netstats_check($assembly_id)
      namenode_port = netstat_response['data']['results'].select { |x| x['port'] == port}.first['port']
      namenode_port.should eq(port)
{'fraction_non_alphanumeric': 0.09350237717908082, 'fraction_numerical': 0.0, 'mean_word_length': 4.2824267782426775, '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': '4652683', 'n_tokens_mistral': 816, 'n_tokens_neox': 810, 'n_words': 214}