def minimal_cr
{
command: ['echo', 'hello'],
- container_image: 'test',
+ container_image: 'arvados/apitestfixture:latest',
output_path: 'test',
+ runtime_constraints: {vcpus: 1, ram: 1}
}
end
sp = {'partitions' => ['test1', 'test2']}
post :create, params: {
- container_request: minimal_cr.merge(scheduling_parameters: sp.dup)
+ container_request: minimal_cr.merge(scheduling_parameters: sp.dup, state: "Committed")
}
assert_response :success
cr = JSON.parse(@response.body)
assert_not_nil cr, 'Expected container request'
- assert_equal sp, cr['scheduling_parameters']
+ assert_equal sp['partitions'], cr['scheduling_parameters']['partitions']
+ assert_equal false, cr['scheduling_parameters']['preemptible']
+ assert_equal false, cr['scheduling_parameters']['supervisor']
+ end
+
+ test 'create a-c-r should be supervisor' do
+ authorize_with :active
+
+ post :create, params: {
+ container_request: minimal_cr.merge(command: ["arvados-cwl-runner", "my-workflow.cwl"], state: "Committed")
+ }
+ assert_response :success
+
+ cr = JSON.parse(@response.body)
+ assert_not_nil cr, 'Expected container request'
+ assert_equal true, cr['scheduling_parameters']['supervisor']
end
test "secret_mounts not in #create responses" do
assert_equal 'bar', req.secret_mounts['/foo']['content']
end
+ test "cancel with runtime_constraints and scheduling_params with default values" do
+ authorize_with :active
+ req = container_requests(:queued)
+
+ patch :update, params: {
+ id: req.uuid,
+ container_request: {
+ state: 'Final',
+ priority: 0,
+ runtime_constraints: {
+ 'vcpus' => 1,
+ 'ram' => 123,
+ 'keep_cache_ram' => 0,
+ },
+ scheduling_parameters: {
+ "preemptible"=>false
+ }
+ },
+ }
+ assert_response :success
+ end
+
test "update without deleting secret_mounts" do
authorize_with :active
req = container_requests(:uncommitted)