Sha256: 0429557225ba25f42b0c9f326f273143197c8ab8e6ed47faeca3c15855e0c51c

Contents?: true

Size: 1.98 KB

Versions: 10

Compression:

Stored size: 1.98 KB

Contents

require 'rubygems'
require 'test/unit'
require 'fileutils'
require 'shoulda'

class IntegrationTest < Test::Unit::TestCase

  def stop!
    system "export INTEGRATION_TEST=true; bin/testbot --server stop > /dev/null"
    system "export INTEGRATION_TEST=true; bin/testbot --runner stop > /dev/null"
  end

  # This is slow, and Test:Unit does not have "before/after :all" method, so I'm using a single testcase for multiple tests
  should "be able to send a build request, have it run and show the results" do
    Thread.new {

      sleep 30
      puts "Still running after 30 secs, stopping..."
      stop!
    }

    system "rm -rf tmp; mkdir -p tmp; cp -rf test/fixtures/local tmp/local"
    system "export INTEGRATION_TEST=true; bin/testbot --runner --connect 127.0.0.1 --working_dir tmp/runner > /dev/null"
    system "export INTEGRATION_TEST=true; bin/testbot --server > /dev/null"

    # For debug
    # Thread.new do
    #   system "export INTEGRATION_TEST=true; bin/testbot --runner run --connect 127.0.0.1 --working_dir tmp/runner"
    # end
    # Thread.new do
    #   system "export INTEGRATION_TEST=true; bin/testbot --server run"
    # end

    sleep 2.0
    result = `cd tmp/local; INTEGRATION_TEST=true ../../bin/testbot --spec --connect 127.0.0.1 --rsync_path ../server --rsync_ignores "log/* tmp/*"`
  
    # Should include the result from script/spec
    #puts result.inspect
    assert result.include?('script/spec got called with ["-O", "spec/spec.opts", "spec/models/house_spec.rb", "spec/models/car_spec.rb"]') ||
           result.include?('script/spec got called with ["-O", "spec/spec.opts", "spec/models/car_spec.rb", "spec/models/house_spec.rb"]')           
    

    # Should not include ignored files
    assert !File.exists?("tmp/server/log/test.log")
    assert !File.exists?("tmp/server/tmp/restart.txt")
    assert !File.exists?("tmp/runner/local/log/test.log")
    assert !File.exists?("tmp/runner/local/tmp/restart.txt")
  end
  
  def teardown
    stop!
    FileUtils.rm_rf "tmp"
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
testbot_instructure-0.7.9 test/integration_test.rb
testbot_instructure-0.7.8 test/integration_test.rb
testbot-0.7.8 test/integration_test.rb
testbot-0.7.7 test/integration_test.rb
testbot-0.7.6 test/integration_test.rb
testbot-0.7.5 test/integration_test.rb
testbot-0.7.3 test/integration_test.rb
testbot-0.7.2 test/integration_test.rb
testbot-0.7.1 test/integration_test.rb
testbot-0.7.0 test/integration_test.rb