@@ -21,6 +21,7 @@ let test_introduce_duplicate_repo_name () =
21
21
let name_description_1 = " description1" in
22
22
let binary_url = " https://repo.example.com" in
23
23
let binary_url_1 = " https://repo1.example.com" in
24
+ let binary_url_2 = " https://1.1.1.1/repository/enabled" in
24
25
let source_url = " https://repo-src.example.com" in
25
26
let source_url_1 = " https://repo-src1.example.com" in
26
27
let gpgkey_path = " " in
@@ -42,6 +43,14 @@ let test_introduce_duplicate_repo_name () =
42
43
Repository. introduce_bundle ~__context ~name_label
43
44
~name_description: name_description_1
44
45
|> ignore
46
+ ) ;
47
+ Alcotest. check_raises " test_introduce_duplicate_repo_name_3"
48
+ Api_errors. (Server_error (repository_already_exists, [Ref. string_of ref ]))
49
+ (fun () ->
50
+ Repository. introduce_remote_pool ~__context ~name_label
51
+ ~name_description: name_description_1 ~binary_url: binary_url_2
52
+ ~certificate: " "
53
+ |> ignore
45
54
)
46
55
47
56
let test_introduce_duplicate_binary_url () =
@@ -58,7 +67,7 @@ let test_introduce_duplicate_binary_url () =
58
67
Repository. introduce ~__context ~name_label ~name_description ~binary_url
59
68
~source_url ~update: true ~gpgkey_path
60
69
in
61
- Alcotest. check_raises " test_introduce_duplicate_binary_url "
70
+ Alcotest. check_raises " test_introduce_duplicate_binary_url_1 "
62
71
Api_errors. (Server_error (repository_already_exists, [Ref. string_of ref ]))
63
72
(fun () ->
64
73
Repository. introduce ~__context ~binary_url ~name_label: name_label_1
@@ -110,6 +119,56 @@ let test_introduce_duplicate_bundle_repo () =
110
119
|> ignore
111
120
)
112
121
122
+ let test_introduce_invalid_remote_pool_repo_url () =
123
+ let __context = T. make_test_database () in
124
+ let name_label = " name" in
125
+ let name_label_1 = " name1" in
126
+ let name_description = " description" in
127
+ let valid_url = " https://1.1.1.1/repository/enabled" in
128
+ let invalid_url_1 = " http://1.1.1.1/repository/enabled" in
129
+ let invalid_url_2 = " https://1.1.1.257/repository/enabled" in
130
+ let invalid_url_3 = " https://test.com/repository/enabled" in
131
+ let invalid_url_4 = " https://1.1.1.1/other" in
132
+ let invalid_url_5 = " https://1.1.1.1" in
133
+ Repository. introduce_remote_pool ~__context ~name_label ~name_description
134
+ ~binary_url: valid_url ~certificate: " "
135
+ |> ignore ;
136
+ Alcotest. check_raises " test_introduce_duplicate_bundle_repo_1"
137
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_1]))
138
+ (fun () ->
139
+ Repository. introduce_remote_pool ~__context ~name_label: name_label_1
140
+ ~name_description ~binary_url: invalid_url_1 ~certificate: " "
141
+ |> ignore
142
+ ) ;
143
+ Alcotest. check_raises " test_introduce_duplicate_bundle_repo_2"
144
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_2]))
145
+ (fun () ->
146
+ Repository. introduce_remote_pool ~__context ~name_label: name_label_1
147
+ ~name_description ~binary_url: invalid_url_2 ~certificate: " "
148
+ |> ignore
149
+ ) ;
150
+ Alcotest. check_raises " test_introduce_duplicate_bundle_repo_3"
151
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_3]))
152
+ (fun () ->
153
+ Repository. introduce_remote_pool ~__context ~name_label: name_label_1
154
+ ~name_description ~binary_url: invalid_url_3 ~certificate: " "
155
+ |> ignore
156
+ ) ;
157
+ Alcotest. check_raises " test_introduce_duplicate_bundle_repo_4"
158
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_4]))
159
+ (fun () ->
160
+ Repository. introduce_remote_pool ~__context ~name_label: name_label_1
161
+ ~name_description ~binary_url: invalid_url_4 ~certificate: " "
162
+ |> ignore
163
+ ) ;
164
+ Alcotest. check_raises " test_introduce_duplicate_bundle_repo_5"
165
+ Api_errors. (Server_error (invalid_base_url, [invalid_url_5]))
166
+ (fun () ->
167
+ Repository. introduce_remote_pool ~__context ~name_label: name_label_1
168
+ ~name_description ~binary_url: invalid_url_5 ~certificate: " "
169
+ |> ignore
170
+ )
171
+
113
172
let test =
114
173
[
115
174
( " test_introduce_duplicate_repo_name"
@@ -128,6 +187,10 @@ let test =
128
187
, `Quick
129
188
, test_introduce_duplicate_bundle_repo
130
189
)
190
+ ; ( " test_introduce_invalid_remote_pool_repo_url"
191
+ , `Quick
192
+ , test_introduce_invalid_remote_pool_repo_url
193
+ )
131
194
]
132
195
133
196
let () =
0 commit comments