Compare commits
2 commits
083f961ac4
...
75f337b995
Author | SHA1 | Date | |
---|---|---|---|
75f337b995 | |||
580a8830e3 |
4 changed files with 13 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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;
|
||||
]
|
||||
|
|
|
@ -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.)
|
||||
|
||||
|
|
Loading…
Reference in a new issue