From 64e16d970ac5ec5c6887ac0c5478f0bb31f4fd8a Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Thu, 21 Oct 2021 16:37:57 +0000 Subject: [PATCH] EMR - Step state should be RUNNING, not STARTING (#4455) --- moto/emr/models.py | 2 +- tests/test_emr/test_emr.py | 8 ++++---- tests/test_emr/test_emr_boto3.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/moto/emr/models.py b/moto/emr/models.py index c67252152..85cb6918c 100644 --- a/moto/emr/models.py +++ b/moto/emr/models.py @@ -356,7 +356,7 @@ class FakeCluster(BaseModel): # If we already have other steps, this one is pending fake = FakeStep(state="PENDING", **step) else: - fake = FakeStep(state="STARTING", **step) + fake = FakeStep(state="RUNNING", **step) self.steps.append(fake) added_steps.append(fake) self.state = "RUNNING" diff --git a/tests/test_emr/test_emr.py b/tests/test_emr/test_emr.py index 9cb12cfa6..79c167ad9 100644 --- a/tests/test_emr/test_emr.py +++ b/tests/test_emr/test_emr.py @@ -592,7 +592,7 @@ def test_steps(): step.name.should.be.a(str) # step.readydatetime.should.be.a(str) # step.startdatetime.should.be.a(str) - step.state.should.be.within(["STARTING", "PENDING"]) + step.state.should.be.within(["RUNNING", "PENDING"]) expected = dict((s.name, s) for s in input_steps) @@ -617,7 +617,7 @@ def test_steps(): # properties x.should.have.property("id").should.be.a(str) x.name.should.equal(y.name) - x.status.state.should.be.within(["STARTING", "PENDING"]) + x.status.state.should.be.within(["RUNNING", "PENDING"]) # x.status.statechangereason x.status.timeline.creationdatetime.should.be.a(str) # x.status.timeline.enddatetime.should.be.a(str) @@ -641,7 +641,7 @@ def test_steps(): # properties x.should.have.property("id").should.be.a(str) x.name.should.equal(y.name) - x.status.state.should.be.within(["STARTING", "PENDING"]) + x.status.state.should.be.within(["RUNNING", "PENDING"]) # x.status.statechangereason x.status.timeline.creationdatetime.should.be.a(str) # x.status.timeline.enddatetime.should.be.a(str) @@ -653,7 +653,7 @@ def test_steps(): # step_states argument. steps = conn.list_steps(cluster_id).steps step_id = steps[0].id - steps = conn.list_steps(cluster_id, step_states=["STARTING"]).steps + steps = conn.list_steps(cluster_id, step_states=["RUNNING"]).steps steps.should.have.length_of(1) steps[0].id.should.equal(step_id) diff --git a/tests/test_emr/test_emr_boto3.py b/tests/test_emr/test_emr_boto3.py index 0a7e3f9f4..b4d5bcd77 100644 --- a/tests/test_emr/test_emr_boto3.py +++ b/tests/test_emr/test_emr_boto3.py @@ -991,7 +991,7 @@ def test_steps(): # x['ExecutionStatusDetail'].should.have.key('LastStateChangeReason') # x['ExecutionStatusDetail'].should.have.key('StartDateTime') x["ExecutionStatusDetail"]["State"].should.equal( - "STARTING" if idx == 0 else "PENDING" + "RUNNING" if idx == 0 else "PENDING" ) x["StepConfig"]["ActionOnFailure"].should.equal("TERMINATE_CLUSTER") x["StepConfig"]["HadoopJarStep"]["Args"].should.equal( @@ -1021,7 +1021,7 @@ def test_steps(): # Properties x["Id"].should.be.a(str) x["Name"].should.equal(y["Name"]) - x["Status"]["State"].should.be.within(["STARTING", "PENDING"]) + x["Status"]["State"].should.be.within(["RUNNING", "PENDING"]) # StateChangeReason x["Status"]["Timeline"]["CreationDateTime"].should.be.a("datetime.datetime") # x['Status']['Timeline']['EndDateTime'].should.be.a('datetime.datetime') @@ -1037,7 +1037,7 @@ def test_steps(): # Properties x["Id"].should.be.a(str) x["Name"].should.equal(y["Name"]) - x["Status"]["State"].should.be.within(["STARTING", "PENDING"]) + x["Status"]["State"].should.be.within(["RUNNING", "PENDING"]) # StateChangeReason x["Status"]["Timeline"]["CreationDateTime"].should.be.a("datetime.datetime") # x['Status']['Timeline']['EndDateTime'].should.be.a('datetime.datetime') @@ -1048,7 +1048,7 @@ def test_steps(): steps.should.have.length_of(1) steps[0]["Id"].should.equal(step_id) - steps = client.list_steps(ClusterId=cluster_id, StepStates=["STARTING"])["Steps"] + steps = client.list_steps(ClusterId=cluster_id, StepStates=["RUNNING"])["Steps"] steps.should.have.length_of(1) steps[0]["Id"].should.equal(step_id)