
    
                     h    S r SSKJr  SSKJr  SrSrSrSrSr	Sr
 " S	 S
\R                  5      rS rg)a.  Module to define and determine exit codes for 'gcloud test' commands.

Note: Cloud-SDK-eng is reserving exit codes 1..9 for http errors, invalid args,
bad filename, etc. Gcloud command surfaces are free to use exit codes 10..20.
Gaps in exit_code numbering are left in case future expansion is needed.
    )
exceptions)log
               c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )TestOutcomeError$   z=The Tool Results backend did not return a valid test outcome.c                 2   > [         [        U ]  U[        S9  g )N)	exit_code)superr   __init__INFRASTRUCTURE_ERR)selfmsg	__class__s     5lib/googlecloudsdk/api_lib/firebase/test/exit_code.pyr   TestOutcomeError.__init__'   s    	
D*3:L*M     )__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r   r   $   s    EN Nr   r   c                    U (       a  U R                   (       d  [        R                  " S5        [        $ U R                   UR                  :X  d  U R                   UR
                  :X  a  [        $ U R                   UR                  :X  a  [        $ U R                   UR                  :X  a  [        $ U R                   UR                  :X  a  [        $ [        SR                  U R                   5      5      e)aq  Map a test roll-up outcome into the appropriate gcloud test exit_code.

Args:
  outcome: a toolresults_v1.Outcome message.
  summary_enum: a toolresults.Outcome.SummaryValueValuesEnum reference.

Returns:
  The exit_code which corresponds to the test execution's rolled-up outcome.

Raises:
  TestOutcomeError: If Tool Results service returns an invalid outcome value.
z<Tool Results service did not provide a roll-up test outcome.z(Unknown test outcome summary value '{0}')summaryr   warningINCONCLUSIVEsuccessflakyROLLUP_SUCCESSfailureROLLUP_FAILUREskippedUNSUPPORTED_ENVinconclusiver   format)outcomesummary_enums     r   ExitCodeFromRollupOutcomer/   +   s     
KKNOoo---	L..	.__,,,__,,,__111077H	J Jr   N)r   googlecloudsdk.corer   core_exceptionsr   r&   r(   r#   r*   MATRIX_CANCELLEDr   Errorr   r/   r   r   r   <module>r4      sN     > #   N,, NJr   