- test "one" do
- r = [{started_at: 1, finished_at: 3}]
- assert_equal 2, determine_wallclock_runtime(r)
-
- r = [{started_at: 1, finished_at: 5}]
- assert_equal 4, determine_wallclock_runtime(r)
-
- r = [{started_at: 1, finished_at: 2}, {started_at: 3, finished_at: 5}]
- assert_equal 3, determine_wallclock_runtime(r)
-
- r = [{started_at: 3, finished_at: 5}, {started_at: 1, finished_at: 2}]
- assert_equal 3, determine_wallclock_runtime(r)
-
- r = [{started_at: 3, finished_at: 5}, {started_at: 1, finished_at: 2},
- {started_at: 2, finished_at: 4}]
- assert_equal 4, determine_wallclock_runtime(r)
-
- r = [{started_at: 1, finished_at: 5}, {started_at: 2, finished_at: 3}]
- assert_equal 4, determine_wallclock_runtime(r)
-
- r = [{started_at: 3, finished_at: 5}, {started_at: 1, finished_at: 4}]
- assert_equal 4, determine_wallclock_runtime(r)
+ def create_instance_long_enough_to(instance_attrs={})
+ # create 'two_part' pipeline with the given instance attributes
+ pt_fixture = api_fixture('pipeline_templates')['two_part']
+ post :create, {
+ pipeline_instance: instance_attrs.merge({
+ pipeline_template_uuid: pt_fixture['uuid']
+ }),
+ format: :json
+ }, session_for(:active)
+ assert_response :success
+ pi_uuid = assigns(:object).uuid
+ assert_not_nil assigns(:object)
+
+ # yield
+ yield pi_uuid, pt_fixture
+
+ # delete the pipeline instance
+ use_token :active
+ PipelineInstance.where(uuid: pi_uuid).first.destroy
+ end