HUE-7258 [jb] fix unit test

Review Request #12297 - Created Jan. 4, 2018 and submitted

Ying Chen
hue
master
HUE-7258
hue
enricoberti, jgauthier, johan, krish, romain, test, weixia
commit b0cfa09b3f780c2449a00e4cd89b091b92cac65a
Author: Ying Chen <yingchen@cloudera.com>
Date:   Thu Jan 4 16:24:55 2018 -0800

    HUE-7258 [jb] Fix test_spark_job in TestMapReduce2NoHadoop

:100644 100644 dc02c7d932... ffd6ccf902... M    apps/jobbrowser/src/jobbrowser/tests.py
Jenkins Job #90 (origin/ying_unit_test2) failed but unrelated error.

Local Test:

build/env/bin/hue test specific jobbrowser.tests:TestMapReduce2NoHadoop

----------------------------------------------------------------------
Ran 9 tests in 12.314s

OK
Destroying test database for alias 'default'...
[05/Jan/2018 11:31:08 -0800] test         INFO     Tests (jobbrowser.tests:TestMapReduce2NoHadoop) returned 0
  • 0
  • 0
  • 10
  • 0
  • 10
Description From Last Updated
  1. Better with proper monkey patching of the spark HS?

    (note: the job id might need to be changed to macht the one in the mocked Spark HS)

  2. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 1)
     
     

    , spark_history_server_api

  3. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 1)
     
     
     
     

    no need normally

  4. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 1)
     
     
     
     
     

    no need normally

  5. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 1)
     
     

    spark_history_server_api.get_history_server_api = lambda: MockSparkHistoryApi()
    ?

    https://github.com/cloudera/hue/blob/master/apps/jobbrowser/src/jobbrowser/api.py#L73

    (and usually backup/revert above and in teradown)

  6. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 1)
     
     
     
     
     
     

    revert spark_history_server_api

  7. 
      
  1. Could we get a better commit message?

  2. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 2)
     
     

    Why this would not work?

    spark_history_server_api.get_history_server_api = MockSparkHistoryApi()

    ?

    1. I will try this. Sent out review before see this comment.
  3. 
      
  1. 
      
  2. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 2)
     
     

    spark_history_server_api.get_history_server_api = lambda: MockSparkHistoryApi()

  3. 
      
  1. Better commit message?

  2. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 3)
     
     

    old_get_history_server_api --> old_get_spark_history_server_api

  3. 
      
  1. Could you make sure it runs locally before updating the reviews?

    And confirm here when the full test passes?

    1. Jenkins Job #90 (origin/ying_unit_test2) failed but unrelated error.
      
      Local Test is OK: 
      build/env/bin/hue test specific jobbrowser.tests:TestMapReduce2NoHadoop
  2. apps/jobbrowser/src/jobbrowser/tests.py (Diff revision 4)
     
     

    spark_history_server_api.old_get_spark_history_server_api

    ...

  3. 
      
  1. Ship It!
  2. 
      
Review request changed

Status: Closed (submitted)

Loading...