class_docstr: State machine that computes the next state of a test based on the current state and
  perform actions accordingly during the state transition. For example:
  - passing -[two last results failed]-> failing: create github issue
  - failing -[last result passed]-> passing: close github issue
  - jailed -[latest result passed]-> passing: update the test's oncall
  ...
docstr: Compute the next state of the test based on the current state and the test
docstr_tok: ["Compute","the","next","state","of","the","test","based","on","the","current","state","and","the","test"]
code: def _next_state(self, current_state) -> TestState:
      """
      Compute the next state of the test based on the current state and the test
      """
      if current_state == TestState.PASSING:
          if self._passing_to_consistently_failing():
              return TestState.CONSITENTLY_FAILING
          if self._passing_to_failing():
              return TestState.FAILING
          if self._passing_to_flaky():
              return TestState.FLAKY
  
      if current_state == TestState.FAILING:
          if self._failing_to_consistently_failing():
              return TestState.CONSITENTLY_FAILING
          if self._failing_to_passing():
              return TestState.PASSING
  
      if current_state == TestState.CONSITENTLY_FAILING:
          if self._consistently_failing_to_jailed():
              return TestState.JAILED
          if self._consistently_failing_to_passing():
              return TestState.PASSING
          if self._consistently_failing_to_flaky():
              return TestState.FLAKY
  
      if current_state == TestState.FLAKY:
          if self._flaky_to_passing():
              return TestState.PASSING
          if self._flaky_to_jailed():
              return TestState.JAILED
  
      if current_state == TestState.JAILED:
          if self._jailed_to_passing():
              return TestState.PASSING
  
      return current_state
  
imports: import abc
  from github import Github
  from pybuildkite.buildkite import Buildkite
  from ray_release.test import Test, TestState
  from ray_release.aws import get_secret_token
label_desc: Use image node_id 6 for calling the TestStateMachine obj's underlying member method code with example usage: obj._next_state(current_state) and returns: current_state, TestState, TestState, TestState, TestState, TestState, TestState, TestState, TestState, TestState, TestState, TestState