diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index 8e6e63b9405983be8b2f69d6d9103cd9a3b8d129..a7b2f0e97d0301a5ae6ccd5ae400004507dc6642 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -3513,7 +3513,7 @@ resto.unit:x86_64: - oc.build_x86_64-exp-dev-extra dependencies: - oc.docker:ci:amd64 - timeout: 60 minutes + timeout: 10 minutes before_script: - . ./scripts/ci/datadog_send_job_info.sh - eval $(opam env) @@ -3537,7 +3537,7 @@ resto.unit:arm64: - oc.build_arm64-exp-dev-extra dependencies: - oc.docker:ci:arm64 - timeout: 60 minutes + timeout: 10 minutes before_script: - . ./scripts/ci/datadog_send_job_info.sh - eval $(opam env) diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index e6aa7fa69a5d5a120172f5e6b6f7d512f8d8a9fa..b48878da82a51419cb56d1bd3f901c3b957a77f1 100644 --- a/.gitlab/ci/pipelines/merge_train.yml +++ b/.gitlab/ci/pipelines/merge_train.yml @@ -3512,7 +3512,7 @@ resto.unit:x86_64: - oc.build_x86_64-exp-dev-extra dependencies: - oc.docker:ci:amd64 - timeout: 60 minutes + timeout: 10 minutes before_script: - . ./scripts/ci/datadog_send_job_info.sh - eval $(opam env) @@ -3536,7 +3536,7 @@ resto.unit:arm64: - oc.build_arm64-exp-dev-extra dependencies: - oc.docker:ci:arm64 - timeout: 60 minutes + timeout: 10 minutes before_script: - . ./scripts/ci/datadog_send_job_info.sh - eval $(opam env) diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index fc2453da5694e7c057c0154438c2e883ec5e8785..cfad5acf7540c78f42af8fd6ee0dd48f77e19450 100644 --- a/.gitlab/ci/pipelines/schedule_extended_test.yml +++ b/.gitlab/ci/pipelines/schedule_extended_test.yml @@ -2974,7 +2974,7 @@ resto.unit:x86_64: - oc.build_x86_64-exp-dev-extra dependencies: - oc.docker:ci:amd64 - timeout: 60 minutes + timeout: 10 minutes interruptible: false before_script: - . ./scripts/ci/datadog_send_job_info.sh @@ -2995,7 +2995,7 @@ resto.unit:arm64: - oc.build_arm64-exp-dev-extra dependencies: - oc.docker:ci:arm64 - timeout: 60 minutes + timeout: 10 minutes interruptible: false before_script: - . ./scripts/ci/datadog_send_job_info.sh diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index b3e80cc0fe4a5f7038aa56d09f75494b9949f5ef..8dba9218868c00ada0c6720fb9b1663ee9c0a1bc 100644 --- a/ci/bin/code_verification.ml +++ b/ci/bin/code_verification.ml @@ -1247,6 +1247,7 @@ let jobs pipeline_type = ?storage ~image:Images.CI.test ~stage:Stages.test + ~timeout:(Minutes 10) ~rules: (make_rules ~changes: diff --git a/resto/test/chunked_output_integration_test.ml b/resto/test/chunked_output_integration_test.ml index 61fba94f9dd668977a64d6a3501797a822712bc4..8026917e121fb94a7eb8b351b3ac2223f480e494 100644 --- a/resto/test/chunked_output_integration_test.ml +++ b/resto/test/chunked_output_integration_test.ml @@ -155,21 +155,30 @@ let directory = in dir -let port = 8001 - -let uri = "http://localhost:8001" +(* copy-pasted from tezt/lib_tezos/port.ml + use SO_REUSEADDR *) +(* TODO port resto tests to Tezt *) +let fresh_port () = + let dummy_socket = Unix.(socket PF_INET SOCK_STREAM 0) in + (* allows rebinding to a port that is in TIME_WAIT *) + Unix.setsockopt dummy_socket Unix.SO_REUSEADDR true ; + Fun.protect ~finally:(fun () -> Unix.close dummy_socket) @@ fun () -> + Unix.bind dummy_socket Unix.(ADDR_INET (inet_addr_loopback, 0)) ; + let addr = Unix.getsockname dummy_socket in + match addr with ADDR_INET (_, port) -> port | _ -> assert false + +let uri port = "http://localhost:" ^ string_of_int port let is_ok_result r v = match r with `Ok (Some w) -> assert (v = w) | _ -> assert false -let child () = +let child port = let module Client = Resto_cohttp_client.Client.Make (Encoding) (Resto_cohttp_client.Client.OfCohttp (Cohttp_lwt_unix.Client)) in let logger = Client.full_logger Format.err_formatter in - let base = Uri.of_string uri in + let base = port |> uri |> Uri.of_string in let media_types = media_types 1 in let open Lwt.Infix in Client.call_service media_types ~base ~logger get_foo_bar () () () @@ -185,7 +194,7 @@ let child () = module Server = Resto_cohttp_server.Server.Make (Encoding) (Logger) -let parent pid chunk_size = +let parent pid port chunk_size = let media_types = media_types chunk_size in Server.init_and_launch ~media_types directory (`TCP (`Port port)) >>= fun () -> @@ -194,13 +203,14 @@ let parent pid chunk_size = | _ -> assert false let test_one_size chunk_size = + let port = fresh_port () in match Lwt_unix.fork () with | 0 -> ( match Lwt_unix.fork () with | 0 -> Lwt_unix.sleep 2.0 (* leave time for the server to start *) - >>= fun () -> child () - | pid -> parent pid chunk_size) + >>= fun () -> child port + | pid -> parent pid port chunk_size) | pid -> ( Lwt_unix.waitpid [] pid >>= function | _, WEXITED 0 -> Lwt.return ()