From 580a8830e3738bf73ddd4cbf46fd1a31a202961a Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Tue, 17 Dec 2024 12:11:44 +0100 Subject: [PATCH] update to uuidm 0.9.9 deprecations --- bin/migrations/m20220509.ml | 4 ++-- builder-web.opam | 1 + test/router.ml | 16 ++++++++-------- test/test_builder_db.ml | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/migrations/m20220509.ml b/bin/migrations/m20220509.ml index 686854f..4742a89 100644 --- a/bin/migrations/m20220509.ml +++ b/bin/migrations/m20220509.ml @@ -6,9 +6,9 @@ and rollback_doc = "switch uuid encoding back to binary" open Grej.Infix let old_uuid_rep = - let encode uuid = Ok (Uuidm.to_bytes uuid) in + let encode uuid = Ok (Uuidm.to_binary_string uuid) in let decode s = - Uuidm.of_bytes s + Uuidm.of_binary_string s |> Option.to_result ~none:"failed to decode uuid" in Caqti_type.custom ~encode ~decode Caqti_type.string diff --git a/builder-web.opam b/builder-web.opam index 26fa37b..a835fa8 100644 --- a/builder-web.opam +++ b/builder-web.opam @@ -49,6 +49,7 @@ depends: [ "solo5-elftool" {>= "0.3.0"} "decompress" {>= "1.5.0"} "digestif" {>= "1.2.0"} + "uuidm" {>= "0.9.9"} "alcotest" {>= "1.2.0" & with-test} "ppx_deriving" {with-test} "ppx_deriving_yojson" {with-test} diff --git a/test/router.ml b/test/router.ml index 65ba2d7..953161d 100644 --- a/test/router.ml +++ b/test/router.ml @@ -85,7 +85,7 @@ let test_link method_ target () = let test_link_artifact artifact = let job_name = "test" in - let build = Uuidm.v `V4 in + let build = Uuidm.v4_gen (Random.State.make_self_init ()) () in test_link `GET @@ Builder_web.Link.Job_build_artifact.make ~job_name ~build ~artifact () @@ -108,12 +108,12 @@ let () = end; test_case "Link.Job_build.make" `Quick begin let job_name = "test" in - let build = Uuidm.v `V4 in + let build = Uuidm.v4_gen (Random.State.make_self_init ()) () in test_link `GET @@ Builder_web.Link.Job_build.make ~job_name ~build () end; test_case "Link.Job_build_artifact.make_from_string" `Quick begin let job_name = "test" in - let build = Uuidm.v `V4 in + let build = Uuidm.v4_gen (Random.State.make_self_init ()) () in let artifact = "" in test_link `GET @@ Builder_web.Link.Job_build_artifact.make_from_string @@ -140,8 +140,8 @@ let () = ) ) @ Alcotest.[ test_case "Link.Compare_builds.make" `Quick begin - let left = Uuidm.v `V4 in - let right = Uuidm.v `V4 in + let left = Uuidm.v4_gen (Random.State.make_self_init ()) () in + let right = Uuidm.v4_gen (Random.State.make_self_init ()) () in test_link `GET @@ Builder_web.Link.Compare_builds.make ~left ~right () end; @@ -177,12 +177,12 @@ let () = end; begin let job = "foo" in - let build = Uuidm.(v `V4 |> to_string) in + let build = Uuidm.(v4_gen (Random.State.make_self_init ()) () |> to_string) in "/job/" ^ job ^ "/build/" ^ build ^ "/main-binary" end; begin - let old_uuid = Uuidm.(v `V4 |> to_string) in - let new_uuid = Uuidm.(v `V4 |> to_string) in + let old_uuid = Uuidm.(v4_gen (Random.State.make_self_init ()) () |> to_string) in + let new_uuid = Uuidm.(v4_gen (Random.State.make_self_init ()) () |> to_string) in Fmt.str "/compare/%s/%s" old_uuid new_uuid end; ] diff --git a/test/test_builder_db.ml b/test/test_builder_db.ml index 5ef158d..3bd8a15 100644 --- a/test/test_builder_db.ml +++ b/test/test_builder_db.ml @@ -123,7 +123,7 @@ let test_user_unauth (module Db : CONN) = let job_name = "test-job" let script = Fpath.v "/dev/null" -let uuid = Uuidm.v `V4 +let uuid = Uuidm.v4_gen (Random.State.make_self_init ()) () let console = Fpath.v "/dev/null" let start = Option.get (Ptime.of_float_s 0.) let finish = Option.get (Ptime.of_float_s 1.) @@ -195,7 +195,7 @@ let test_build_get_all (module Db : CONN) = Db.collect_list Builder_db.Build.get_all job_id >>| fun builds -> Alcotest.(check int) "one build" (List.length builds) 1 -let uuid' = Uuidm.v `V4 +let uuid' = Uuidm.v4_gen (Random.State.make_self_init ()) () let start' = Option.get (Ptime.of_float_s 3600.) let finish' = Option.get (Ptime.of_float_s 3601.) -- 2.47.1