Skip to content

Commit 2bd6e76

Browse files
committed
chore: remove duplicate test, simplify comments
1 parent 8f96ed8 commit 2bd6e76

19 files changed

+73
-1082
lines changed

tests/auto_detection_test.ml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ open Test_helpers
22
open Auto_detection
33
open Alcotest
44

5-
(** Test GitLab info detection - should fallback to default domain if not found
6-
*)
75
let test_auto_detect_gitlab_info () =
86
(* Test with real GitLab API if credentials are available, otherwise use mock *)
9-
let bot_info =
10-
match create_real_bot_info () with
11-
| Some info ->
12-
info (* Use real credentials if available *)
13-
| None ->
14-
create_mock_bot_info () (* Fallback to mock *)
15-
in
7+
let bot_info = get_bot_info () in
168
let owner = "test-org" in
179
let repo = "test-repo" in
1810
let result =
@@ -30,12 +22,12 @@ let test_auto_detect_gitlab_info () =
3022

3123
(** Test org/team detection with real API or graceful skip *)
3224
let test_auto_detect_org_team () =
33-
(* Test with real GitHub API if credentials are available *)
34-
match create_real_bot_info () with
25+
let bot_info = get_bot_info () in
26+
(* Skip test if no real credentials - this is expected in CI without secrets *)
27+
match bot_info.github_install_token with
3528
| None ->
36-
(* Skip test if no credentials - this is expected in CI without secrets *)
3729
Alcotest.skip ()
38-
| Some bot_info -> (
30+
| Some _ -> (
3931
(* Use a real public repository for testing that is known to exist *)
4032
let owner = "ocaml" in
4133
let repo = "opam" in
@@ -63,12 +55,12 @@ let test_auto_detect_org_team () =
6355

6456
(** Test complete auto-detection with caching *)
6557
let test_auto_detect_from_apis () =
66-
(* Test with real GitHub API if credentials are available *)
67-
match create_real_bot_info () with
58+
let bot_info = get_bot_info () in
59+
(* Skip test if no real credentials *)
60+
match bot_info.github_install_token with
6861
| None ->
69-
(* Skip test if no credentials - this is expected in CI without secrets *)
7062
Alcotest.skip ()
71-
| Some bot_info ->
63+
| Some _ ->
7264
(* Use a real public repository for testing *)
7365
let owner = "ocaml" in
7466
let repo = "opam" in
@@ -102,10 +94,12 @@ let test_auto_detect_from_apis () =
10294

10395
(** Test that auto_detect_from_apis returns a complete Repo_config.t *)
10496
let test_auto_detect_from_apis_completeness () =
105-
match create_real_bot_info () with
97+
let bot_info = get_bot_info () in
98+
(* Skip test if no real credentials *)
99+
match bot_info.github_install_token with
106100
| None ->
107101
Alcotest.skip ()
108-
| Some bot_info ->
102+
| Some _ ->
109103
let owner = "ocaml" in
110104
let repo = "opam" in
111105
Cache.clear_all () ;
@@ -124,8 +118,6 @@ let test_auto_detect_from_apis_completeness () =
124118
check bool "org_name is Some" (Option.is_some result.org_name) true ;
125119
(* team_name should be Some *)
126120
check bool "team_name is Some" (Option.is_some result.team_name) true ;
127-
(* minimizer_url may be Some (if BOT_MINIMIZER_URL env var is set) or None (generic default) *)
128-
(* This is acceptable - minimizer_url is optional and can be configured per-repo *)
129121
(* ci_config should be Some (from defaults) *)
130122
check bool "ci_config is Some" (Option.is_some result.ci_config) true
131123

tests/config_resolver_test.ml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ open Repo_config
22
open Alcotest
33
open Test_helpers
44

5-
let bot_info =
6-
match create_real_bot_info () with
7-
| Some info ->
8-
info
9-
| None ->
10-
create_mock_bot_info ()
5+
let bot_info = get_bot_info ()
116

127
let test_merge_priority_explicit_overrides () =
138
let explicit_config =
@@ -70,7 +65,6 @@ let test_merge_priority_api_fills_gaps () =
7065
check (option string) "api team_name" result.team_name (Some "maintainers")
7166

7267
let test_merge_priority_defaults_fallback () =
73-
(* Skip test if no real credentials - API calls require installation token *)
7468
( match bot_info.github_install_token with
7569
| None ->
7670
Alcotest.skip ()

tests/default_config_test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ let () =
4848
[ ( "defaults"
4949
, [test_case "defaults for any repo" `Quick test_defaults_for_any_repo] )
5050
; ( "no_hardcoded_patterns"
51-
, [ test_case "defaults for any repo" `Quick
51+
, [ test_case "no hardcoded patterns" `Quick
5252
test_defaults_no_hardcoded_patterns ] ) ]

tests/dune

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -50,76 +50,15 @@
5050
(libraries base bot-components config alcotest lwt lwt.unix)
5151
(modules test_helpers config_resolver_test))
5252

53-
(test
54-
(name refactored_code_test_helpers)
55-
(libraries base bot-components config utils)
56-
(modules refactored_code_test_helpers))
57-
58-
(test
59-
(name refactored_code_generic_test)
60-
(libraries base bot-components config alcotest utils)
61-
(modules
62-
test_helpers
63-
refactored_code_test_helpers
64-
refactored_code_generic_test))
65-
66-
(test
67-
(name refactored_code_backport_test)
68-
(libraries base bot-components config alcotest)
69-
(modules
70-
test_helpers
71-
refactored_code_test_helpers
72-
refactored_code_backport_test))
73-
74-
(test
75-
(name refactored_code_jobs_test)
76-
(libraries base bot-components config alcotest)
77-
(modules
78-
test_helpers
79-
refactored_code_test_helpers
80-
refactored_code_jobs_test))
81-
82-
(test
83-
(name refactored_code_ci_test)
84-
(libraries base bot-components config alcotest)
85-
(modules test_helpers refactored_code_test_helpers refactored_code_ci_test))
86-
87-
(test
88-
(name refactored_code_documentation_test)
89-
(libraries base bot-components config alcotest)
90-
(modules
91-
test_helpers
92-
refactored_code_test_helpers
93-
refactored_code_documentation_test))
94-
95-
(test
96-
(name refactored_code_gitlab_test)
97-
(libraries base bot-components config alcotest)
98-
(modules
99-
test_helpers
100-
refactored_code_test_helpers
101-
refactored_code_gitlab_test))
102-
103-
(test
104-
(name refactored_code_bench_test)
105-
(libraries base bot-components config alcotest)
106-
(modules
107-
test_helpers
108-
refactored_code_test_helpers
109-
refactored_code_bench_test))
110-
11153
(test
11254
(name refactored_code_edge_cases_test)
11355
(libraries base bot-components config alcotest utils)
114-
(modules
115-
test_helpers
116-
refactored_code_test_helpers
117-
refactored_code_edge_cases_test))
56+
(modules test_helpers refactored_code_edge_cases_test))
11857

11958
(test
12059
(name job_status_custom_test)
12160
(libraries base bot-components config alcotest ci lwt lwt.unix)
122-
(modules test_helpers refactored_code_test_helpers job_status_custom_test))
61+
(modules test_helpers job_status_custom_test))
12362

12463
(test
12564
(name generic_bot_demo_test)

0 commit comments

Comments
 (0)