mariadb-cli 0.1.1

One-shot agent-native command line client for MariaDB servers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
//! Proving what only a real server can answer about how a run is shaped.
//!
//! # Why these need a destination
//!
//! Each of the promises below is about what the server did, or did not do,
//! after the marks on the command line were obeyed. Whether a simulation left
//! the rows untouched, whether a value carrying a quote and a semicolon stayed
//! one value, whether a restriction matched a row the server then left alone —
//! none of that can be answered by reading the product's own layers, because
//! the answer lives on the other side of the wire.
//!
//! Every proof here builds a table of its own, fills it, reads it and removes
//! it, so two runs against the same server never meet each other's rows.
//!
//! # Writes travel inside a block
//!
//! A change written on its own is reported as applied and is not there
//! afterwards; only `query tx` leaves it behind. So the rows these proofs need
//! are inserted inside a block, and the proofs about a single statement are
//! about what that statement reports rather than about what it leaves.

// Each file here uses the part of the shared module that it needs, so a
// helper unused by this one is not dead code.
#[allow(dead_code)]
mod support;

use support::server::{destination_or_skip, on_server, unique_mark};
use support::{Outcome, Sandbox};

/// A table name no other run of this suite will repeat.
fn own_table() -> String {
    format!("shop.flow_{}", unique_mark())
}

/// Builds an empty table of two columns and hands back its name.
fn build(sandbox: &Sandbox, dsn: &str, table: &str) {
    let made = on_server(
        sandbox,
        dsn,
        &[
            "--yes",
            "query",
            "run",
            &format!("CREATE TABLE {table} (id INT PRIMARY KEY, label VARCHAR(64))"),
        ],
    );
    assert_eq!(made.code, 0, "building `{table}`: {}", made.err);
}

/// The table one proof owns, removed however that proof ends.
///
/// The removal used to be a call at the tail of each test, under a comment
/// promising it happened "whatever the proof concluded". It did not: a tail
/// call runs only once every assertion before it has passed, so a proof that
/// failed left its table behind on a server this whole suite shares. One was
/// found sitting there, which is what turned the promise into a measurement.
///
/// Dropping runs on the unwinding path as well, which is the only place that
/// promise can actually be kept. Nothing here asserts, because a panic while
/// unwinding aborts the process and would replace a readable failure with an
/// unreadable one.
struct Owned<'a> {
    /// The location the invocations run from.
    sandbox: &'a Sandbox,
    /// The destination the table lives on.
    dsn: String,
    /// The table, qualified by its database.
    name: String,
}

impl<'a> Owned<'a> {
    /// Builds the table and takes ownership of removing it.
    fn built(sandbox: &'a Sandbox, dsn: &str) -> Self {
        let claimed = Self::claimed(sandbox, dsn);
        build(sandbox, dsn, &claimed.name);
        claimed
    }

    /// Takes ownership of removing a name the proof will create itself.
    ///
    /// One proof here creates its table with a statement of structure sent
    /// inside a block, because what it measures is that such a statement escapes
    /// the block. That table cannot be built by the helper above without
    /// destroying the very thing being measured, so the name is claimed first
    /// and the removal is owned from that moment — including the case where the
    /// creation itself never happens, which `IF EXISTS` already tolerates.
    fn claimed(sandbox: &'a Sandbox, dsn: &str) -> Self {
        Self {
            sandbox,
            dsn: dsn.to_owned(),
            name: own_table(),
        }
    }
}

impl Drop for Owned<'_> {
    fn drop(&mut self) {
        let removed = on_server(
            self.sandbox,
            &self.dsn,
            &[
                "--yes",
                "query",
                "run",
                &format!("DROP TABLE IF EXISTS {}", self.name),
            ],
        );
        support::server::confirm_removed(&removed, &format!("the table {}", self.name));
    }
}

/// Writes rows that survive the invocation, which means inside a block.
fn fill(sandbox: &Sandbox, dsn: &str, statement: &str) -> Outcome {
    let written = on_server(
        sandbox,
        dsn,
        &["--yes", "query", "tx", "--statement", statement],
    );
    assert_eq!(written.code, 0, "writing rows: {}", written.err);
    written
}

/// The signature of everything the table holds, read in a fixed order.
fn signature(sandbox: &Sandbox, dsn: &str, table: &str) -> String {
    let read = on_server(
        sandbox,
        dsn,
        &[
            "--checksum",
            "query",
            "run",
            &format!("SELECT id, label FROM {table} ORDER BY id"),
        ],
    );
    assert_eq!(read.code, 0, "reading `{table}`: {}", read.err);
    read.answer()["checksum"]
        .as_str()
        .unwrap_or_else(|| panic!("the read must carry a signature: {}", read.out))
        .to_owned()
}

/// FR-025. A simulated change reports the effect it would have had and leaves
/// the table exactly as it found it.
///
/// The table is signed before and after. Comparing the count alone would pass a
/// simulation that deleted two rows and wrote two others back, and comparing
/// the rows by eye would pass one that reordered them; the signature covers
/// every byte of what the read returned, in a fixed order.
///
/// The predicted count is asserted against the rows that are really there, so a
/// simulation that answered zero for everything — perfectly harmless and
/// perfectly useless — fails here.
#[test]
fn a_simulated_change_predicts_its_effect_and_changes_nothing() {
    let Some(dsn) = destination_or_skip("simulating a change without applying it") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();

    fill(
        &sandbox,
        &dsn,
        &format!("INSERT INTO {table} (id, label) VALUES (1, 'um'), (2, 'dois'), (3, 'tres')"),
    );
    let before = signature(&sandbox, &dsn, &table);

    let simulated = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "--dry-run",
            "query",
            "run",
            &format!("DELETE FROM {table} WHERE id > 1"),
        ],
    );
    assert_eq!(simulated.code, 0, "the simulation runs: {}", simulated.err);

    let answer = simulated.answer();
    assert_eq!(
        answer["data"]["simulated"],
        serde_json::json!(true),
        "the answer has to say it was a simulation: {answer}"
    );
    assert_eq!(
        answer["data"]["predicted_rows"],
        serde_json::json!(2),
        "two rows match the restriction, and the prediction has to say so: {answer}"
    );

    let after = signature(&sandbox, &dsn, &table);

    assert_eq!(
        before, after,
        "the simulation changed the table it was only supposed to describe"
    );
}

/// FR-025. A simulation of a statement the validation already refuses reports
/// that refusal instead of succeeding quietly.
///
/// A simulation that accepted anything would be worse than none: the whole use
/// of it is to be told, before applying, what the real run would say.
#[test]
fn a_simulation_of_a_refused_statement_reports_the_refusal() {
    let Some(dsn) = destination_or_skip("simulating a statement the validation refuses") else {
        return;
    };
    let sandbox = Sandbox::new();

    let refused = on_server(
        &sandbox,
        &dsn,
        &["--yes", "--dry-run", "query", "run", "DELETE FROM WHERE"],
    );

    assert_ne!(refused.code, 0, "an unreadable statement is not a success");
    assert_eq!(
        refused.failure()["error"]["category"],
        "validation",
        "the simulation has to answer with the validation's own refusal: {}",
        refused.err
    );
    assert!(
        refused.out.is_empty(),
        "a failure never reaches the primary channel"
    );
}

/// FR-026. A value carrying a quote and a semicolon arrives as one value and
/// never as part of the statement.
///
/// The value is the shape an injection takes. It is written and read back, so
/// what is asserted is not only that the run survived but that the whole text,
/// punctuation included, is what the column now holds.
#[test]
fn a_value_shaped_like_an_injection_stays_one_value() {
    let Some(dsn) = destination_or_skip("binding a value that looks like an injection") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();

    let dangerous = "O'Brien'; DROP TABLE clientes; --";

    let echoed = on_server(
        &sandbox,
        &dsn,
        &["query", "run", "SELECT ? AS valor", "--param", dangerous],
    );
    assert_eq!(echoed.code, 0, "the value is bound: {}", echoed.err);
    assert_eq!(
        echoed.rows()[0]["valor"],
        serde_json::json!(dangerous),
        "the value came back changed, so something read it as statement text"
    );

    let written = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "query",
            "tx",
            "--statement",
            &format!("INSERT INTO {table} (id, label) VALUES (1, {dangerous:?})"),
        ],
    );
    // The literal above is written by this proof and not by a caller, so it is
    // quoted by the writer rather than bound; what matters here is only that
    // the table still exists afterwards, which the read below settles.
    assert_eq!(written.code, 0, "writing the row: {}", written.err);

    let still_there = on_server(
        &sandbox,
        &dsn,
        &[
            "query",
            "run",
            &format!("SELECT COUNT(*) AS n FROM {table}"),
        ],
    );
    assert_eq!(
        still_there.rows()[0]["n"],
        serde_json::json!(1),
        "the table lost its row, so the punctuation was obeyed as a statement"
    );
}

/// FR-027. A statement read from the standard input produces exactly the answer
/// the same statement produces as an argument.
///
/// Both channels are driven and the primary channel is compared byte for byte.
/// Comparing the rows alone would pass a run that arrived by one channel with a
/// different shape around them, which is the caller's whole contract.
#[test]
fn a_statement_read_from_the_input_answers_exactly_as_an_argument_does() {
    let Some(dsn) = destination_or_skip("reading the statement from the standard input") else {
        return;
    };
    let sandbox = Sandbox::new();
    let statement = "SELECT 1 AS um, 'dois' AS texto";

    let as_argument = on_server(&sandbox, &dsn, &["query", "run", statement]);
    assert_eq!(as_argument.code, 0, "{}", as_argument.err);

    let mut command = assert_cmd::Command::cargo_bin("mariadb-cli").expect("the binary is built");
    let finished = command
        .arg("--config-dir")
        .arg(sandbox.path())
        .args(["--dsn", &dsn, "query", "run", "--stdin"])
        .write_stdin(statement)
        .output()
        .expect("the binary runs");

    assert_eq!(
        finished.status.code(),
        Some(as_argument.code),
        "the two channels must end the same way"
    );
    assert_eq!(
        String::from_utf8_lossy(&finished.stdout),
        as_argument.out,
        "the same statement by two channels must answer with the same bytes"
    );
}

/// FR-037. Asking for the count alone answers with the number the whole read
/// would have returned, and with no rows at all.
///
/// Both halves are needed. A count that matched but still carried the rows
/// would save the caller nothing, and a count that carried no rows but answered
/// a different number would be worse than the rows.
#[test]
fn asking_for_the_count_alone_agrees_with_the_whole_read() {
    let Some(dsn) = destination_or_skip("counting without carrying the rows") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();
    fill(
        &sandbox,
        &dsn,
        &format!(
            "INSERT INTO {table} (id, label) VALUES (1, 'um'), (2, 'dois'), (3, 'tres'), \
             (4, 'quatro')"
        ),
    );

    let read = format!("SELECT id, label FROM {table} ORDER BY id");
    let whole = on_server(&sandbox, &dsn, &["query", "run", &read]);
    let counted = on_server(&sandbox, &dsn, &["--count-only", "query", "run", &read]);

    assert_eq!(whole.code, 0, "{}", whole.err);
    assert_eq!(counted.code, 0, "{}", counted.err);

    let rows = whole.rows();
    assert_eq!(rows.len(), 4, "the table was filled with four rows");

    let answer = counted.answer();
    assert_eq!(
        answer["data"]["count"],
        serde_json::json!(rows.len()),
        "the count has to be the number of rows the whole read returned: {answer}"
    );
    assert!(
        answer["data"]["rows"].is_null(),
        "asking for the count alone must carry no rows: {answer}"
    );
}

/// FR-037, the failure the requirement publishes: counting a change ends in 2.
///
/// # What this caught
///
/// The flag was being dropped in silence. A count is a question about a
/// reading — how many rows would come back — and of a change there is no such
/// number, so the requirement gives the combination the usage number. Measured
/// before this proof existed: with the confirmation present the change RAN, the
/// answer carried the affected count, and nothing anywhere said the flag had
/// been ignored. A caller who wrote `--count-only` to be told a size caused one
/// instead.
///
/// The second half is the one that matters. Asserting the number alone would
/// pass on a refusal that arrived after the server had already been changed.
#[test]
fn asking_the_count_of_a_change_is_refused_before_the_change_happens() {
    let Some(dsn) = destination_or_skip("refusing a count of a change") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();
    fill(
        &sandbox,
        &dsn,
        &format!("INSERT INTO {table} (id, label) VALUES (1, 'um'), (2, 'dois')"),
    );

    // The confirmation is present on purpose: without it the refusal for not
    // confirming would answer first, and this would pass while proving nothing
    // about the flag.
    let change = format!("UPDATE {table} SET label = 'trocado'");
    let refused = on_server(
        &sandbox,
        &dsn,
        &["--count-only", "--yes", "query", "run", &change],
    );

    assert_eq!(
        refused.code, 2,
        "the requirement publishes the usage number for this combination: {}",
        refused.out
    );
    assert_eq!(
        refused.code(),
        "usage.count_of_a_change",
        "the refusal must name the combination it refuses: {}",
        refused.out
    );

    // The refusal has to come before anything is applied, so the rows are the
    // ones that were put there.
    let ordered = format!("SELECT label FROM {table} ORDER BY id");
    let after = on_server(&sandbox, &dsn, &["query", "run", &ordered]);
    assert_eq!(after.code, 0, "{}", after.err);
    let labels: Vec<String> = after
        .rows()
        .iter()
        .map(|row| row["label"].as_str().unwrap_or_default().to_owned())
        .collect();
    assert_eq!(
        labels,
        vec!["um".to_owned(), "dois".to_owned()],
        "the change must not have happened: {}",
        after.out
    );
}

/// FR-133. A change reports what the restriction matched and what the server
/// really altered as two separate numbers, and says which of them was asked
/// for.
///
/// A row is written to the value it already holds. The restriction matches it,
/// and the server alters nothing, which is the one case where the two numbers
/// differ and the only one that shows they are not the same number wearing two
/// names. Both marks are driven, so what is asserted is also that the choice
/// travels: the number the caller receives follows what was asked for.
#[test]
fn a_change_separates_what_it_matched_from_what_it_altered() {
    let Some(dsn) = destination_or_skip("separating matched rows from altered rows") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();
    fill(
        &sandbox,
        &dsn,
        &format!("INSERT INTO {table} (id, label) VALUES (1, 'um')"),
    );

    let idle = format!("UPDATE {table} SET label = 'um' WHERE id = 1");

    let matched = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "--row-count",
            "matched",
            "query",
            "tx",
            "--statement",
            &idle,
        ],
    );
    let changed = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "--row-count",
            "changed",
            "query",
            "tx",
            "--statement",
            &idle,
        ],
    );

    assert_eq!(matched.code, 0, "{}", matched.err);
    assert_eq!(changed.code, 0, "{}", changed.err);

    let under_matched = &matched.answer()["data"]["rows"][0]["rows"];
    assert_eq!(
        under_matched["matched"],
        serde_json::json!(1),
        "the restriction matched the row: {under_matched}"
    );
    assert_eq!(
        under_matched["changed"],
        serde_json::json!(0),
        "the row already held that value, so nothing was altered: {under_matched}"
    );
    assert_eq!(under_matched["requested"], serde_json::json!("matched"));
    assert_eq!(
        under_matched["affected"],
        serde_json::json!(1),
        "the number handed over has to be the one that was asked for: {under_matched}"
    );

    let under_changed = &changed.answer()["data"]["rows"][0]["rows"];
    assert_eq!(under_changed["matched"], serde_json::json!(1));
    assert_eq!(under_changed["changed"], serde_json::json!(0));
    assert_eq!(under_changed["requested"], serde_json::json!("changed"));
    assert_eq!(
        under_changed["affected"],
        serde_json::json!(0),
        "asking for what was altered must not hand over what was matched: {under_changed}"
    );
}

/// FR-029. A statement of structure inside an atomic block always produces the
/// warning that it escaped the block, and the block still finishes.
///
/// The warning is the whole point: such a statement confirms itself on the
/// server, so the block cannot undo it, and a caller who believed the block
/// covered everything would be wrong about what a later failure would take
/// back. The block is asserted to have finished as well, because a warning that
/// cost the run would be a refusal wearing another name.
#[test]
fn a_statement_of_structure_inside_a_block_always_warns_that_it_escaped() {
    let Some(dsn) = destination_or_skip("warning that a definition escapes the block") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::claimed(&sandbox, &dsn);
    let table = owned.name.clone();

    let block = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "query",
            "tx",
            "--statement",
            "SELECT 1",
            "--statement",
            &format!("CREATE TABLE {table} (id INT PRIMARY KEY)"),
        ],
    );

    assert_eq!(block.code, 0, "the block finishes: {}", block.err);
    let answer = block.answer();
    assert_eq!(
        answer["data"]["confirmed"],
        serde_json::json!(true),
        "the block was confirmed: {answer}"
    );

    let gaps = answer["gaps"]
        .as_array()
        .unwrap_or_else(|| panic!("the definition has to be declared: {answer}"));
    assert_eq!(gaps.len(), 1, "one statement escaped, so one gap: {answer}");
    assert_eq!(
        gaps[0]["cause"],
        serde_json::json!("escapes_atomic_block"),
        "the gap has to name the escape: {answer}"
    );

    // A block of statements that all belong to it carries no such gap, or the
    // assertion above would be true of every block and mean nothing.
    let ordinary = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "query",
            "tx",
            "--statement",
            "SELECT 1",
            "--statement",
            "SELECT 2",
        ],
    );
    assert_eq!(ordinary.code, 0, "{}", ordinary.err);
    assert!(
        ordinary.answer()["gaps"].is_null(),
        "nothing escaped this block, so nothing may say it did: {}",
        ordinary.out
    );
}

/// FR-065. A change that was never confirmed fails at once under the mark that
/// forbids asking, instead of waiting for an answer that will never come.
///
/// The harness gives the process no terminal and closes its input, so a product
/// that asked would hang here rather than fail — which is exactly the outcome
/// the mark exists to make impossible. The invocation ending at all, with the
/// refusal that names the missing confirmation, is the proof.
///
/// The same statement with the confirmation is driven afterwards, so what is
/// asserted is that the refusal was about the confirmation and not about the
/// statement being impossible.
#[test]
fn a_change_that_was_never_confirmed_fails_at_once_rather_than_asking() {
    let Some(dsn) = destination_or_skip("refusing to ask when asking is forbidden") else {
        return;
    };
    let sandbox = Sandbox::new();
    let owned = Owned::built(&sandbox, &dsn);
    let table = owned.name.clone();
    fill(
        &sandbox,
        &dsn,
        &format!("INSERT INTO {table} (id, label) VALUES (1, 'um')"),
    );

    let statement = format!("DELETE FROM {table} WHERE id = 1");

    let unconfirmed = on_server(&sandbox, &dsn, &["--no-input", "query", "run", &statement]);
    assert_eq!(
        unconfirmed.code, 3,
        "an unconfirmed change is refused, not asked about: {}",
        unconfirmed.err
    );
    assert_eq!(
        unconfirmed.code(),
        "safety.unconfirmed",
        "the refusal has to name the missing confirmation: {}",
        unconfirmed.err
    );
    assert!(
        unconfirmed.out.is_empty(),
        "a failure never reaches the primary channel"
    );

    let confirmed = on_server(
        &sandbox,
        &dsn,
        &["--no-input", "--yes", "query", "run", &statement],
    );
    assert_eq!(
        confirmed.code, 0,
        "the same change, confirmed, has to run under the same mark: {}",
        confirmed.err
    );
}

/// FR-097. An empty separator is refused as incorrect use, and the file is
/// never opened.
///
/// The path named is one that does not exist. A run that read the file first
/// would answer that it is missing, so the identifier of the refusal is what
/// proves the order.
#[test]
fn an_empty_separator_is_refused_before_the_file_is_opened() {
    let Some(dsn) = destination_or_skip("refusing a separator that separates nothing") else {
        return;
    };
    let sandbox = Sandbox::new();

    let refused = on_server(
        &sandbox,
        &dsn,
        &[
            "--yes",
            "query",
            "file",
            "/caminho/que/nao/existe/rotina.sql",
            "--delimiter",
            "",
        ],
    );

    assert_eq!(refused.code, 2, "incorrect use exits two: {}", refused.err);
    assert_eq!(
        refused.code(),
        "usage.empty_delimiter",
        "a missing file must not be what this run reports: {}",
        refused.err
    );
    assert!(
        refused.out.is_empty(),
        "a failure never reaches the primary channel"
    );
}