Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
test: add new step "then stdout is empty"
Lars Wirzenius committed 1 year ago
commit 842ce74f0227ac6fe584ce3555d2f5ca477ce318
parent 768b96689078e66e8688a401d6d080c5710e4fea
3 files changed +32 -15
modified ci-broker.md
@@ -266,7 +266,7 @@ then file reports/status.json exists

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

when I run cibtool --db ci-broker.db run list --json
then stdout contains ""id": "xyzzy""
@@ -453,7 +453,7 @@ when I try to run bash radenv.sh RAD_SOCKET=synt.sock cib --config broker.yaml i
when I run cat synt.log
then command is successful
when I run cibtool --db ci-broker.db run list
-
then stdout is exactly ""
+
then stdout is empty
~~~


@@ -796,7 +796,7 @@ then stderr contains "Action: run:"
then stderr contains "Action: shutdown"

when I run cibtool --db ci-broker.db event list
-
then stdout is exactly ""
+
then stdout is empty

when I run cibtool --db ci-broker.db run list --json
then stdout contains "success"
@@ -909,7 +909,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db event add --repo testy --ref main --commit HEAD --base HEAD --id-file id.txt

@@ -920,7 +920,7 @@ then stdout contains "main"
when I run cibtool --db x.db event remove --id-file id.txt

when I run cibtool --db x.db event list
-
then stdout is exactly ""
+
then stdout is empty
~~~

## Can remove all queued events
@@ -940,7 +940,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db event add --repo testy --ref main --commit HEAD --base HEAD
when I run bash radenv.sh cibtool --db x.db event add --repo testy --ref main --commit HEAD --base HEAD
@@ -951,7 +951,7 @@ when I run bash radenv.sh cibtool --db x.db event add --repo testy --ref main --

when I run cibtool --db x.db event remove --all
when I run cibtool --db x.db event list
-
then stdout is exactly ""
+
then stdout is empty
~~~

## Can add shutdown event to queue
@@ -967,7 +967,7 @@ _Who:_ `cib-devs`
~~~scenario
given an installed cibtool
when I run cibtool --db x.db event list
-
then stdout is exactly ""
+
then stdout is empty

when I run cibtool --db x.db event shutdown --id-file id.txt

@@ -1014,7 +1014,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db run add --id xyzzy --repo testy --branch main --commit main --triggered
when I run cibtool --db x.db run list --json
@@ -1037,7 +1037,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db run add --repo testy --url https://x/1 --branch main --commit HEAD --running
when I run cibtool --db x.db run list --json
@@ -1062,7 +1062,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db run add --id xyzzy --repo testy --branch main --commit HEAD --success
when I run cibtool --db x.db run list --json
@@ -1087,7 +1087,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db run add --id xyzzy --repo testy --branch main --commit HEAD --failure
when I run cibtool --db x.db run list --json
@@ -1096,7 +1096,7 @@ then stdout contains ""result": "failure""
then stdout contains "xyzzy"

when I run cibtool --db x.db run list --adapter-run-id abracadabra
-
then stdout is exactly ""
+
then stdout is empty
~~~

## Update and show information about run to running
@@ -1114,7 +1114,7 @@ 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 exactly ""
+
then stdout is empty

when I run bash radenv.sh cibtool --db x.db run add --id x --repo testy --branch main --commit HEAD --triggered
when I run cibtool --db x.db run list
@@ -1268,7 +1268,7 @@ then stdout contains "BranchUpdated"

given file deny.yaml
when I run cibtool event filter deny.yaml ci-events.json
-
then stdout is exactly ""
+
then stdout is empty
~~~

~~~{#allow.yaml .file .yaml}
modified ci-broker.yaml
@@ -17,3 +17,8 @@
  impl:
    rust:
      function: stdout_has_one_line
+

+
- then: "stdout is empty"
+
  impl:
+
    rust:
+
      function: stdout_is_empty
modified src/subplot.rs
@@ -72,3 +72,15 @@ fn stdout_has_one_line(runcmd: &Runcmd) {
        throw!(format!("stdout had {linecount} lines, expected 1"));
    }
}
+

+
#[step]
+
#[context(SubplotContext)]
+
#[context(Runcmd)]
+
fn stdout_is_empty(runcmd: &Runcmd) {
+
    let stdout = runcmd.stdout_as_string();
+
    if !stdout.is_empty() {
+
        throw!(format!(
+
            "expected stdout to be empty, is actually {stdout:?}"
+
        ));
+
    }
+
}