test/tc_server.rb in t2-server-0.9.3 vs test/tc_server.rb in t2-server-1.0.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2010-2012 The University of Manchester, UK. +# Copyright (c) 2010-2013 The University of Manchester, UK. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -38,10 +38,16 @@ assert_nothing_raised(T2Server::ConnectionError) do T2Server::Server.new($uri, $conn_params) end end + def test_server_connection_no_params + assert_nothing_raised(T2Server::ConnectionError) do + T2Server::Server.new($uri) + end + end + def test_run_creation T2Server::Server.new($uri, $conn_params) do |server| assert_nothing_raised(T2Server::T2ServerError) do run = server.create_run($wkf_pass, $creds) run.delete @@ -51,16 +57,31 @@ # Need to do these together so testing the limit is cleaned up! def test_server_limits_delete_all T2Server::Server.new($uri, $conn_params) do |server| limit = server.run_limit($creds) + max_runs = 0 assert_instance_of(Fixnum, limit) assert_raise(T2Server::ServerAtCapacityError) do + # Detect the concurrent run limit and # add 1 just in case there are no runs at this point + more = true (limit + 1).times do - server.create_run($wkf_pass, $creds) + run = server.create_run($wkf_pass, $creds) + if more + run.input_port("IN").value = "Hello" + more = run.start + if more + max_runs += 1 + assert(run.running?) + else + assert(run.initialized?) + end + end end end + + assert(max_runs <= limit) assert_nothing_raised(T2Server::T2ServerError) do server.delete_all_runs($creds) end end