Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
test: have just one step to install all of CI broker
Lars Wirzenius committed 1 year ago
commit d76efe40073b0dcde00c2cb20768259aa10f6f66
parent 842ce74f0227ac6fe584ce3555d2f5ca477ce318
3 files changed +38 -98
modified ci-broker.md
@@ -223,7 +223,7 @@ output is in the JSON format. It does not try to make sure the JSON
matches the YAML semantically.

~~~scenario
-
given an installed cib
+
given an installed CI broker
given file broker.yaml
when I run cib --config broker.yaml config --output actual.json
when I run jq . actual.json
@@ -241,17 +241,16 @@ nothing else has a hope of working.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed synthetic-events
given file refsfetched.json
given file set-rid
when I run bash radenv.sh env HOME=../homedir python3 set-rid refsfetched.json testy
when I run synthetic-events synt.sock refsfetched.json --log log.txt

-
given an installed cib
given a directory reports
given file broker.yaml
given file adapter.sh from dummy.sh
@@ -264,7 +263,6 @@ then stderr contains "CI broker ends successfully"
then file reports/index.html exists
then file reports/status.json exists

-
given an installed cibtool
when I run cibtool --db ci-broker.db event list
then stdout is empty

@@ -284,15 +282,14 @@ reports.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
when I run cib --version
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+$

-
given an installed cibtool
when I run cibtool --version
then stdout matches regex ^radicle-ci-broker \d+\.\d+\.\d+$
~~~
@@ -314,11 +311,11 @@ user can access individual logs.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed synthetic-events
given file refsfetched.json
given file set-rid
when I run bash radenv.sh env HOME=../homedir python3 set-rid refsfetched.json testy
@@ -327,7 +324,6 @@ when I run synthetic-events synt.sock refsfetched.json --log log.txt
given file adapter.sh from adapter-with-url.sh
when I run chmod +x adapter.sh

-
given an installed cib
given file broker.yaml
given a directory reports

@@ -354,11 +350,11 @@ reduces the support burden on the Radicle project.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
given file broker.yaml
when I try to run bash radenv.sh RAD_SOCKET=xyzzy.sock cib --config broker.yaml insert
then command fails
@@ -382,11 +378,11 @@ a thing that can always be made better. We can later add more
scenarios if we tighten the acceptance criteria.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
given file broker.yaml
given file not-yaml.yaml
when I try to run env HOME=homedir cib --config not-yaml.yaml config
@@ -412,12 +408,11 @@ handled by a dedicated system, such as `systemd`.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
-
given an installed synthetic-events
when I run synthetic-events synt.sock --log log.txt
given file broker.yaml
when I try to run bash radenv.sh RAD_SOCKET=synt.sock cib --config broker.yaml insert
@@ -441,12 +436,11 @@ an object id of all zeros. This should be sufficiently impossible to
happen in real life.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
-
given an installed synthetic-events
given file broker.yaml
when I run synthetic-events synt.sock --log synt.log
when I try to run bash radenv.sh RAD_SOCKET=synt.sock cib --config broker.yaml insert
@@ -467,11 +461,11 @@ _Why:_ This is useful for diagnosis, if nothing else.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run bash radenv.sh cibtool --db x.db run add --repo testy --branch main --commit HEAD --failure

given a directory reports
@@ -495,15 +489,14 @@ error output. This makes it easier to debug adapter problems.
_Who:_ `adapter-devs`, `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run bash radenv.sh cibtool --db ci-broker.db trigger --repo testy --ref main --commit HEAD
when I run bash radenv.sh cibtool --db ci-broker.db event list --json

-
given an installed cib
given file broker.yaml
given a directory reports
given file adapter.sh from dummy.sh
@@ -523,11 +516,11 @@ _Why:_ This allows controlling how much log spew log admins have to see.
_Who:_ `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
given file broker.yaml
given a directory reports

@@ -622,7 +615,7 @@ time: if the time is too short, the scenario fails spuriously, and if
it's very long, the scenario takes longer than necessary.

~~~scenario
-
given an installed synthetic-events
+
given an installed CI broker

then file synt.sock does not exist

@@ -659,7 +652,7 @@ work of multiple processes, either.
_Who:_ `cib-devs`

~~~scenario
-
given an installed cibtool
+
given an installed CI broker
then file count.db does not exist
when I run cibtool --db count.db counter show
then stdout is exactly "0\n"
@@ -681,13 +674,11 @@ in a node change.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
-
given an installed synthetic-events
-

given file refsfetched.json
when I run synthetic-events synt.sock refsfetched.json --log synt.log

@@ -711,13 +702,11 @@ _Why:_ We need at least some rudimentary performance testing.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
-
given an installed synthetic-events
-

given file refsfetched.json
when I run synthetic-events synt.sock refsfetched.json --log synt.log --repeat 1000

@@ -741,13 +730,11 @@ in a node change.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
-
given an installed synthetic-events
-

given file refsfetched.json
when I run synthetic-events synt.sock refsfetched.json --log synt.log

@@ -775,6 +762,7 @@ events. We carefully add a shutdown event so that the CI broker shuts
down.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh
@@ -782,9 +770,6 @@ when I run bash radenv.sh bash setup-node.sh
given file adapter.sh from dummy.sh
when I run chmod +x adapter.sh

-
given an installed cib
-
given an installed cibtool
-

when I run bash radenv.sh cibtool --db ci-broker.db event add --repo testy --ref main --commit HEAD
when I run cibtool --db ci-broker.db event shutdown

@@ -820,7 +805,7 @@ count to a desired goal. The script then verifies that everything went
correctly.

~~~scenario
-
given an installed cibtool
+
given an installed CI broker
given file count.sh
when I run env bash -x count.sh 100 10
then stdout contains "OK\n"
@@ -903,11 +888,11 @@ itself for this test, but the id shouldn't matter, it just needs to
be of the correct form.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db event list
then stdout is empty

@@ -934,11 +919,11 @@ operator wants to prevent many CI runs from happening.
_Who:_ `cib-devs`, `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db event list
then stdout is empty

@@ -965,7 +950,7 @@ to be able to do this cleanly.
_Who:_ `cib-devs`

~~~scenario
-
given an installed cibtool
+
given an installed CI broker
when I run cibtool --db x.db event list
then stdout is empty

@@ -986,11 +971,11 @@ _Who:_ `cib-devs`


~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run bash radenv.sh cibtool --db x.db trigger --repo testy --ref main --commit HEAD --id-file id.txt

when I run cibtool --db x.db event show --id-file id.txt
@@ -1008,11 +993,11 @@ _Why:_ This is primarily needed for testing.
_Who:_ `cib-devs`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db run list
then stdout is empty

@@ -1031,11 +1016,11 @@ _Why:_ This is primarily needed for testing.
_Who:_ `cib-dev`.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db run list
then stdout is empty

@@ -1056,11 +1041,11 @@ _Why:_ This is primarily needed for testing.
_Who:_ `cib-dev`.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db run list
then stdout is empty

@@ -1081,11 +1066,11 @@ _Why:_ This is primarily needed for testing.
_Who:_ `cib-dev`.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db run list
then stdout is empty

@@ -1108,11 +1093,11 @@ _Why:_ This is primarily needed for testing.
_Who:_ `cib-dev`.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
when I run cibtool --db x.db run list
then stdout is empty

@@ -1158,12 +1143,11 @@ Note that we verify both lookup by name and by repository ID, and by
`cibtool event add` and `cibtool trigger`, to cover all the cases.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
-

when I try to run bash radenv.sh cibtool --db x.db event add --repo missing --ref main --commit HEAD --base c0ffee
then command fails
then stderr contains "missing"
@@ -1193,17 +1177,16 @@ useful for gathering data for trying out event filters.
_Who:_ `cib-devs`, `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed synthetic-events
given file refsfetched.json
given file set-rid
when I run bash radenv.sh env HOME=../homedir python3 set-rid refsfetched.json testy
when I run synthetic-events synt.sock refsfetched.json --log log.txt

-
given an installed cibtool
when I run bash radenv.sh cibtool event record --output events.json
then file events.json contains ""type":"refsFetched""
~~~
@@ -1220,17 +1203,16 @@ It's also helpful for CI broker developers as a development tool.
_Who:_ `cib-dev`, `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed synthetic-events
given file refsfetched.json
given file set-rid
when I run bash radenv.sh env HOME=../homedir python3 set-rid refsfetched.json testy
when I run synthetic-events synt.sock refsfetched.json --log log.txt

-
given an installed cibtool
when I run bash radenv.sh cibtool event record --output node-events.json
when I run bash radenv.sh cibtool event ci --output ci-events.json node-events.json
when I run cat ci-events.json
@@ -1248,17 +1230,16 @@ event filters work as they expect.
_Who:_ `cib-dev`, `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed synthetic-events
given file refsfetched.json
given file set-rid
when I run bash radenv.sh env HOME=../homedir python3 set-rid refsfetched.json testy
when I run synthetic-events synt.sock refsfetched.json --log log.txt

-
given an installed cibtool
when I run bash radenv.sh cibtool event record --output node-events.json
when I run bash radenv.sh cibtool event ci --output ci-events.json node-events.json

@@ -1320,6 +1301,7 @@ any events, so `cib` just terminates at once. All of this will work,
when properly set up.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh
@@ -1327,8 +1309,6 @@ when I run bash radenv.sh bash setup-node.sh
given file adapter.sh from dummy.sh
when I run chmod +x adapter.sh

-
given an installed cib
-

given file broker.yaml
given a directory reports
when I run bash radenv.sh cib --config broker.yaml queued
@@ -1351,8 +1331,7 @@ We check this by running the CI broker without a local node. This is
an error it can't recover from.

~~~scenario
-
given an installed cib
-

+
given an installed CI broker
given file broker.yaml
when I try to run env RAD_HOME=/does/not/exist cib --config broker.yaml queued

@@ -1377,11 +1356,11 @@ monitoring system.
_Who:_ `node-ops`

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cib
given file broker.yaml
given a directory reports

@@ -1430,12 +1409,11 @@ the Git commit identifiers instead. In any case, this scenario needs
to be updated when a new release is made.

~~~scenario
+
given an installed CI broker
given file radenv.sh
given file setup-node.sh
when I run bash radenv.sh bash setup-node.sh

-
given an installed cibtool
-
given an installed cib
given file broker.yaml
given file verify-upgrade
given a directory reports
modified ci-broker.yaml
@@ -1,17 +1,7 @@
-
- given: "an installed cib"
+
- given: "an installed CI broker"
  impl:
    rust:
-
      function: install_cib
-

-
- given: "an installed cibtool"
-
  impl:
-
    rust:
-
      function: install_cibtool
-

-
- given: "an installed synthetic-events"
-
  impl:
-
    rust:
-
      function: install_synthetic_events
+
      function: install_ci_broker

- then: "stdout has one line"
  impl:
modified src/subplot.rs
@@ -12,38 +12,10 @@ impl ContextElement for SubplotContext {}
#[step]
#[context(SubplotContext)]
#[context(Runcmd)]
-
fn install_cib(context: &ScenarioContext) {
+
fn install_ci_broker(context: &ScenarioContext) {
    let target_path = bindir();
    assert!(target_path.join("cib").exists());
-
    context.with_mut(
-
        |context: &mut Runcmd| {
-
            context.prepend_to_path(target_path);
-
            Ok(())
-
        },
-
        false,
-
    )?;
-
}
-

-
#[step]
-
#[context(SubplotContext)]
-
#[context(Runcmd)]
-
fn install_cibtool(context: &ScenarioContext) {
-
    let target_path = bindir();
    assert!(target_path.join("cibtool").exists());
-
    context.with_mut(
-
        |context: &mut Runcmd| {
-
            context.prepend_to_path(target_path);
-
            Ok(())
-
        },
-
        false,
-
    )?;
-
}
-

-
#[step]
-
#[context(SubplotContext)]
-
#[context(Runcmd)]
-
fn install_synthetic_events(context: &ScenarioContext) {
-
    let target_path = bindir();
    assert!(target_path.join("synthetic-events").exists());
    context.with_mut(
        |context: &mut Runcmd| {