test/test_torque_helper.rb in osc-machete-1.2.2 vs test/test_torque_helper.rb in osc-machete-2.0.0.pre1

- old
+ new

@@ -104,11 +104,11 @@ end # Test that qdel works for quick batch def test_qdel_quick PBS::Batch.any_instance.stubs(:delete_job).returns(true) - assert_equal true, @shell.qdel("123.quick-batch.ten.osc.edu") + assert_equal true, @shell.qdel("123.quick-batch.osc.edu") PBS::Batch.any_instance.unstub(:delete_job) end # Test that qdel works for Ruby cluster def test_qdel_ruby @@ -118,22 +118,22 @@ end # Test that qdel throws exception on PBS exception def test_qdel_throws_exception PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::Error) - assert_raises(PBS::Error) { @shell.qdel("123.quick-batch.ten.osc.edu") } + assert_raises(PBS::Error) { @shell.qdel("123.quick-batch.osc.edu") } PBS::Batch.any_instance.unstub(:delete_job) PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::SystemError) - assert_raises(PBS::SystemError) { @shell.qdel("123.quick-batch.ten.osc.edu") } + assert_raises(PBS::SystemError) { @shell.qdel("123.quick-batch.osc.edu") } PBS::Batch.any_instance.unstub(:delete_job) end # Test that qdel doesn't throw exception if Unknown Job Id exception def test_qdel_doesnt_throw_exception_on_unknown_job_id PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::UnkjobidError) - @shell.qdel("123.quick-batch.ten.osc.edu") + @shell.qdel("123.quick-batch.osc.edu") PBS::Batch.any_instance.unstub(:delete_job) end def assert_qsub_dependency_list(dependency_list, dependencies, host=nil) assert_equal dependency_list, @shell.qsub_dependencies_header(dependencies) @@ -203,52 +203,7 @@ PBS::Batch.any_instance.expects(:submit_script).with(@script_oakley, has_entry(headers: {})).returns('1234598.oak-batch.osc.edu') @shell.qsub(@script_oakley) PBS::Batch.any_instance.unstub(:submit_script) @shell.unstub(:default_account_string) - end - - def test_pbs_default_host - s = @shell.pbs - assert_equal 'oak-batch.osc.edu', s.host - assert_equal OSC::Machete::TorqueHelper::LIB, s.lib.to_s - assert_equal OSC::Machete::TorqueHelper::BIN, s.bin.to_s - end - - def test_pbs_host_variations - # you can use the cluster ids - assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(host: 'ruby').host - - # or you can use the host itself - assert_equal 'ruby-batch.osc.edu', @shell.pbs(host: 'ruby-batch.osc.edu').host - assert_equal '@ruby-batch', @shell.pbs(host: '@ruby-batch').host - - assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(id: '4567').host - assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(script: @script_ruby).host - assert_equal 'oak-batch.osc.edu', @shell.pbs(script: @script_oakley).host - end - - def test_setting_default_torque_helper - d = OSC::Machete::TorqueHelper.default - - assert_equal 'oak-batch.osc.edu', OSC::Machete::TorqueHelper.default.pbs.host - - # this is an example of how you can quickly modify the default behavior of - # a TorqueHelper instance to provide a new host, id, and script - d2 = OSC::Machete::TorqueHelper.new - class << d2 - def pbs(host: nil, id: nil, script: nil) - PBS::Batch.new( - host: "ruby-batch.osc.edu", - lib: LIB, - bin: BIN - ) - end - end - - OSC::Machete::TorqueHelper.default = d2 - - assert_equal 'ruby-batch.osc.edu', OSC::Machete::TorqueHelper.default.pbs.host - - OSC::Machete::TorqueHelper.default = d end end