Skip to content

Commit

Permalink
Switch pool tests to expect tests
Browse files Browse the repository at this point in the history
This is easier to read, and can be update automatically.
  • Loading branch information
talex5 committed Apr 20, 2021
1 parent 0432573 commit b29f592
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 288 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ocurrent/opam:debian-10-ocaml-4.10@sha256:12fac4e3520657aa72074d2a3b2658776d4b3ce486c930099c996d478c3a2501 AS build
FROM ocaml/opam:debian-10-ocaml-4.12@sha256:ba38dbfbfa92b0dca7171ac33d81276e7209912baf26887ecc20c382d15f32e4 AS build
RUN sudo apt-get update && sudo apt-get install libev-dev capnproto m4 pkg-config libsqlite3-dev libgmp-dev -y --no-install-recommends
RUN cd ~/opam-repository && git pull origin -q master && git reset --hard e132600d1ea27a5be1edfb0079a205ba05830b8e && opam update
RUN cd ~/opam-repository && git pull origin -q master && git reset --hard 1bd3ea712eef197c62c6ab92b2642cc2cda11be2 && opam update
COPY --chown=opam ocluster-api.opam ocluster.opam /src/
COPY --chown=opam obuilder/obuilder.opam obuilder/obuilder-spec.opam /src/obuilder/
RUN opam pin -yn /src/obuilder/
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ocurrent/opam:debian-10-ocaml-4.10@sha256:12fac4e3520657aa72074d2a3b2658776d4b3ce486c930099c996d478c3a2501 AS build
FROM ocaml/opam:debian-10-ocaml-4.12@sha256:ba38dbfbfa92b0dca7171ac33d81276e7209912baf26887ecc20c382d15f32e4 AS build
RUN sudo apt-get update && sudo apt-get install libev-dev capnproto m4 pkg-config libsqlite3-dev libgmp-dev -y --no-install-recommends
RUN cd ~/opam-repository && git pull origin -q master && git reset --hard e132600d1ea27a5be1edfb0079a205ba05830b8e && opam update
RUN cd ~/opam-repository && git pull origin -q master && git reset --hard 1bd3ea712eef197c62c6ab92b2642cc2cda11be2 && opam update
COPY --chown=opam ocluster-api.opam ocluster.opam /src/
COPY --chown=opam obuilder/obuilder.opam obuilder/obuilder-spec.opam /src/obuilder/
RUN opam pin -yn /src/obuilder/
Expand Down
5 changes: 3 additions & 2 deletions current_ocluster.opam
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors: ["talex5@gmail.com"]
homepage: "https://github.com/ocurrent/ocluster"
bug-reports: "https://github.com/ocurrent/ocluster/issues"
depends: [
"dune" {>= "2.5"}
"dune" {>= "2.8"}
"ppx_deriving"
"ocluster-api" {= version}
"lwt"
Expand All @@ -21,9 +21,10 @@ depends: [
"prometheus"
"ppx_deriving_yojson"
"ocaml" {>= "4.10.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
Expand Down
19 changes: 6 additions & 13 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 2.5)
(lang dune 2.8)
(name ocluster)
(formatting disabled)
(generate_opam_files true)
Expand All @@ -8,8 +8,7 @@
(package
(name ocluster-api)
(synopsis "Cap'n Proto API for OCluster")
(description
"OCaml bindings for the OCluster Cap'n Proto API.")
(description "OCaml bindings for the OCluster Cap'n Proto API.")
(depends
ppx_deriving
lwt
Expand All @@ -21,16 +20,9 @@
(name ocluster)
(synopsis "Distribute build jobs to workers")
(description
"OCluster manages a pool of build workers.
A build scheduler service accepts build jobs from clients and distributes them to worker machines using Cap'n Proto.
Workers register themselves by connecting to the scheduler (and workers do not need to be able to accept incoming network connections).
The scheduler can manage multiple pools (e.g. `linux-x86_64` and `linux-arm32`).
Clients say which pool should handle their requests.
At the moment, two build types are provided: building a Dockerfile, or building an OBuilder spec.
In either case, the build may done in the context of some Git commit.
The scheduler tries to schedule similar builds on the same machine, to benefit from caching.")
"OCluster manages a pool of build workers.\nA build scheduler service accepts build jobs from clients and distributes them to worker machines using Cap'n Proto.\nWorkers register themselves by connecting to the scheduler (and workers do not need to be able to accept incoming network connections).\n\nThe scheduler can manage multiple pools (e.g. `linux-x86_64` and `linux-arm32`).\nClients say which pool should handle their requests.\nAt the moment, two build types are provided: building a Dockerfile, or building an OBuilder spec.\nIn either case, the build may done in the context of some Git commit.\nThe scheduler tries to schedule similar builds on the same machine, to benefit from caching.")
(depends
(ppx_expect (>= v0.14.1))
prometheus
ppx_sexp_conv
dune-build-info
Expand Down Expand Up @@ -58,7 +50,8 @@ The scheduler tries to schedule similar builds on the same machine, to benefit f
(package
(name current_ocluster)
(synopsis "OCurrent plugin for OCluster builds")
(description "Creates a stage in an OCurrent pipeline for submitting jobs to OCluster.")
(description
"Creates a stage in an OCurrent pipeline for submitting jobs to OCluster.")
(depends
ppx_deriving
(ocluster-api (= :version))
Expand Down
5 changes: 3 additions & 2 deletions ocluster-api.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ authors: ["talex5@gmail.com"]
homepage: "https://github.com/ocurrent/ocluster"
bug-reports: "https://github.com/ocurrent/ocluster/issues"
depends: [
"dune" {>= "2.5"}
"dune" {>= "2.8"}
"ppx_deriving"
"lwt"
"capnp-rpc-lwt" {>= "0.9.0"}
"fmt"
"ppx_deriving_yojson"
"ocaml" {>= "4.10.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
Expand Down
6 changes: 4 additions & 2 deletions ocluster.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ authors: ["talex5@gmail.com"]
homepage: "https://github.com/ocurrent/ocluster"
bug-reports: "https://github.com/ocurrent/ocluster/issues"
depends: [
"dune" {>= "2.5"}
"dune" {>= "2.8"}
"ppx_expect" {>= "v0.14.1"}
"prometheus"
"ppx_sexp_conv"
"dune-build-info"
Expand All @@ -41,9 +42,10 @@ depends: [
"current_ocluster" {= version & with-test}
"alcotest" {>= "1.0.0" & with-test}
"alcotest-lwt" {>= "1.0.1" & with-test}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
Expand Down
15 changes: 15 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(test
(name test)
(package ocluster)
(modules test mock_builder mock_network test_plugin)
(libraries
alcotest-lwt
capnp-rpc-net
Expand All @@ -12,3 +13,17 @@
logs.fmt
lwt.unix
prometheus-app))

(library
(name ocluster_expect_tests)
(package ocluster)
(modules test_scheduling)
(inline_tests)
(preprocess (pps ppx_expect))
(libraries
cluster_scheduler
db
fmt.tty
logs.fmt
lwt.unix
prometheus-app))
1 change: 0 additions & 1 deletion test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,5 @@ let () =
test_case "admin" admin;
test_case "clients" clients;
];
"scheduling", Test_scheduling.suite;
"plugin", Test_plugin.suite;
]
Loading

0 comments on commit b29f592

Please sign in to comment.