Skip to content

Commit

Permalink
Merge branch 'master' of github.com:barsoom/testbot
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimk committed Jan 19, 2015
2 parents 728e0c5 + 93113e8 commit 6739839
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ GEM
guard-test (2.0.4)
guard (~> 2.0)
test-unit (~> 2.2)
httparty (0.13.0)
httparty (0.13.3)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.6.9)
json (1.8.1)
json_pure (1.8.1)
json (1.8.2)
json_pure (1.8.2)
listen (2.5.0)
celluloid (>= 0.15.2)
celluloid-io (>= 0.15.0)
Expand All @@ -56,9 +56,9 @@ GEM
minitest (4.7.5)
multi_json (1.8.4)
multi_xml (0.5.5)
net-ssh (2.8.0)
net-ssh (2.9.2)
nio4r (1.0.0)
posix-spawn (0.3.8)
posix-spawn (0.3.9)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
Expand Down
31 changes: 17 additions & 14 deletions test/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
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!
stop
}

system "rm -rf tmp; mkdir -p tmp; cp -rf test/fixtures/local tmp/local"
cleanup
system "mkdir -p tmp/fixtures; 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"

Expand All @@ -33,23 +28,31 @@ def stop!

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"]')
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"
stop
cleanup
end

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

def cleanup
system "rm -rf tmp/local tmp/fixtures"
end
end

0 comments on commit 6739839

Please sign in to comment.