77from tests .cli_test_case import CliTestCase
88
99
10- class FlakeDetectionTest (CliTestCase ):
10+ class DetectFlakeTest (CliTestCase ):
1111 @responses .activate
1212 @mock .patch .dict (os .environ , {"LAUNCHABLE_TOKEN" : CliTestCase .launchable_token })
1313 def test_flake_detection_success (self ):
@@ -19,16 +19,15 @@ def test_flake_detection_success(self):
1919 }
2020 responses .add (
2121 responses .GET ,
22- f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /retry/flake-detection " ,
22+ f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /detect-flake " ,
2323 json = mock_json_response ,
2424 status = 200 ,
2525 )
2626 result = self .cli (
27- "retry" ,
28- "flake-detection" ,
27+ "detect-flake" ,
2928 "--session" ,
3029 self .session ,
31- "--confidence " ,
30+ "--retry-threshold " ,
3231 "high" ,
3332 "file" ,
3433 mix_stderr = False ,
@@ -37,22 +36,47 @@ def test_flake_detection_success(self):
3736 self .assertIn ("test_flaky_1.py" , result .stdout )
3837 self .assertIn ("test_flaky_2.py" , result .stdout )
3938
39+ @responses .activate
40+ @mock .patch .dict (os .environ , {"LAUNCHABLE_TOKEN" : CliTestCase .launchable_token })
41+ def test_flake_detection_without_retry_threshold_success (self ):
42+ mock_json_response = {
43+ "testPaths" : [
44+ [{"type" : "file" , "name" : "test_flaky_1.py" }],
45+ [{"type" : "file" , "name" : "test_flaky_2.py" }],
46+ ]
47+ }
48+ responses .add (
49+ responses .GET ,
50+ f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /detect-flake" ,
51+ json = mock_json_response ,
52+ status = 200 ,
53+ )
54+ result = self .cli (
55+ "detect-flake" ,
56+ "--session" ,
57+ self .session ,
58+ "file" ,
59+ mix_stderr = False ,
60+ )
61+ self .assert_success (result )
62+ self .assertIn ("test_flaky_1.py" , result .stdout )
63+ self .assertIn ("test_flaky_2.py" , result .stdout )
64+
4065 @responses .activate
4166 @mock .patch .dict (os .environ , {"LAUNCHABLE_TOKEN" : CliTestCase .launchable_token })
4267 def test_flake_detection_no_flakes (self ):
4368 mock_json_response = {"testPaths" : []}
4469 responses .add (
4570 responses .GET ,
46- f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /retry/flake-detection " ,
71+ f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /detect-flake " ,
4772 json = mock_json_response ,
4873 status = 200 ,
4974 )
5075 result = self .cli (
51- "retry" ,
52- "flake-detection" ,
76+ "detect-flake" ,
5377 "--session" ,
5478 self .session ,
55- "--confidence " ,
79+ "--retry-threshold " ,
5680 "low" ,
5781 "file" ,
5882 mix_stderr = False ,
@@ -65,15 +89,14 @@ def test_flake_detection_no_flakes(self):
6589 def test_flake_detection_api_error (self ):
6690 responses .add (
6791 responses .GET ,
68- f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /retry/flake-detection " ,
92+ f"{ get_base_url ()} /intake/organizations/{ self .organization } /workspaces/{ self .workspace } /detect-flake " ,
6993 status = 500 ,
7094 )
7195 result = self .cli (
72- "retry" ,
73- "flake-detection" ,
96+ "detect-flake" ,
7497 "--session" ,
7598 self .session ,
76- "--confidence " ,
99+ "--retry-threshold " ,
77100 "medium" ,
78101 "file" ,
79102 mix_stderr = False ,
0 commit comments