Repository: getmoto/moto

Issue:
boto3 does not specify `STARTING` as valid EMR step state
https://github.com/spulec/moto/blob/dfa7935e13e6065810d6fc4e1edbf3e86499aea5/moto/emr/models.py#L241

Boto3 documentation for `describe_step()` specifies only the following EMR step states: 

- `PENDING`
- `CANCEL_PENDING`
- `RUNNING`
- `COMPLETED`
- `CANCELLED`
- `FAILED`
- `INTERRUPTED`

So `STARTING` is not a valid state. Default should most probably be changed to `RUNNING`.

Boto3 documentation for `describe_step()`: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/emr.html#EMR.Client.describe_step 


Discussion:

Resolving patch:
diff --git a/moto/emr/models.py b/moto/emr/models.py
--- a/moto/emr/models.py
+++ b/moto/emr/models.py
@@ -356,7 +356,7 @@ def add_steps(self, steps):
                 # 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"


Test patch:
diff --git a/tests/test_emr/test_emr.py b/tests/test_emr/test_emr.py
--- 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_list_steps_with_states():
         # 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
--- 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)