diff --git a/tests/aws/requests/emr/instance_group_tests.rb b/tests/aws/requests/emr/instance_group_tests.rb index b263fc7cc..82448192c 100644 --- a/tests/aws/requests/emr/instance_group_tests.rb +++ b/tests/aws/requests/emr/instance_group_tests.rb @@ -1,7 +1,9 @@ Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do + pending if Fog.mocking? + @job_flow_name = "fog_job_flow_#{Time.now.to_f.to_s.gsub('.','')}" - + @job_flow_options = { 'Instances' => { 'MasterInstanceType' => 'm1.small', @@ -15,7 +17,7 @@ Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do 'HadoopVersion' => '0.20' } } - + @job_flow_steps = { 'Steps' => [{ 'Name' => 'Dummy streaming job', @@ -27,7 +29,7 @@ Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do } }] } - + @instance_group_name = "fog_instance_group_#{Time.now.to_f.to_s.gsub('.','')}" @instance_groups = { 'InstanceGroups' => [{ @@ -37,53 +39,53 @@ Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do 'InstanceCount' => 2 }] } - + result = AWS[:emr].run_job_flow(@job_flow_name, @job_flow_options).body @job_flow_id = result['JobFlowId'] tests('success') do - + tests("#add_instance_groups").formats(AWS::EMR::Formats::ADD_INSTANCE_GROUPS) do pending if Fog.mocking? - + result = AWS[:emr].add_instance_groups(@job_flow_id, @instance_groups).body - + @instance_group_id = result['InstanceGroupIds'].first - + result end - + tests("#describe_job_flows_with_instance_groups").formats(AWS::EMR::Formats::DESCRIBE_JOB_FLOW_WITH_INSTANCE_GROUPS) do pending if Fog.mocking? - + result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body - + result end - + tests("#modify_instance_groups").formats(AWS::EMR::Formats::BASIC) do pending if Fog.mocking? - + # Add a step so the state doesn't go directly from STARTING to SHUTTING_DOWN AWS[:emr].add_job_flow_steps(@job_flow_id, @job_flow_steps) - + # Wait until job has started before modifying the instance group begin sleep 10 - + result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body job_flow = result['JobFlows'].first state = job_flow['ExecutionStatusDetail']['State'] print "." end while(state == 'STARTING') - + # Check results result = AWS[:emr].modify_instance_groups('InstanceGroups' => [{'InstanceGroupId' => @instance_group_id, 'InstanceCount' => 4}]).body - + # Check the it actually modified the instance count tests("modify worked?") do ig_res = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body - + matched = false jf = ig_res['JobFlows'].first jf['Instances']['InstanceGroups'].each do | ig | @@ -91,15 +93,14 @@ Shindo.tests('AWS::EMR | instance groups', ['aws', 'emr']) do matched = true if ig['InstanceRequestCount'].to_i == 4 end end - + matched end - - result + + result end - + end - - + AWS[:emr].terminate_job_flows('JobFlowIds' => [@job_flow_id]) -end \ No newline at end of file +end diff --git a/tests/aws/requests/emr/job_flow_tests.rb b/tests/aws/requests/emr/job_flow_tests.rb index e5b8268e9..45db42b5e 100644 --- a/tests/aws/requests/emr/job_flow_tests.rb +++ b/tests/aws/requests/emr/job_flow_tests.rb @@ -1,7 +1,9 @@ Shindo.tests('AWS::EMR | job flows', ['aws', 'emr']) do + pending if Fog.mocking? + @job_flow_name = "fog_job_flow_#{Time.now.to_f.to_s.gsub('.','')}" - + @job_flow_options = { 'Instances' => { 'MasterInstanceType' => 'm1.small', @@ -15,9 +17,9 @@ Shindo.tests('AWS::EMR | job flows', ['aws', 'emr']) do 'HadoopVersion' => '0.20' } } - + @step_name = "fog_job_flow_step_#{Time.now.to_f.to_s.gsub('.','')}" - + @job_flow_steps = { 'Steps' => [{ 'Name' => @step_name, @@ -29,58 +31,58 @@ Shindo.tests('AWS::EMR | job flows', ['aws', 'emr']) do } }] } - + @job_flow_id = nil tests('success') do - + tests("#run_job_flow").formats(AWS::EMR::Formats::RUN_JOB_FLOW) do pending if Fog.mocking? - + result = AWS[:emr].run_job_flow(@job_flow_name, @job_flow_options).body @job_flow_id = result['JobFlowId'] - + result end - + tests("#add_job_flow_steps").formats(AWS::EMR::Formats::BASIC) do pending if Fog.mocking? - + result = AWS[:emr].add_job_flow_steps(@job_flow_id, @job_flow_steps).body - + result end - + tests("#set_termination_protection").formats(AWS::EMR::Formats::BASIC) do - + result = AWS[:emr].set_termination_protection(true, 'JobFlowIds' => [@job_flow_id]).body test("protected?") do res = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body jf = res['JobFlows'].first - + jf['Instances']['TerminationProtected'] == 'true' end - + result end - + tests("#terminate_job_flow").formats(AWS::EMR::Formats::BASIC) do pending if Fog.mocking? AWS[:emr].set_termination_protection(false, 'JobFlowIds' => [@job_flow_id]) - + result = AWS[:emr].terminate_job_flows('JobFlowIds' => [@job_flow_id]).body - + result end - + tests("#describe_job_flows").formats(AWS::EMR::Formats::SIMPLE_DESCRIBE_JOB_FLOW) do pending if Fog.mocking? - + result = AWS[:emr].describe_job_flows('JobFlowIds' => [@job_flow_id]).body - + result end - + end -end \ No newline at end of file +end