NAME

DBIO::Test::AsyncParity::Cases - The case table of DBIO::Test::AsyncParity: ResultSet operations, once synchronous and once asynchronous

VERSION

version 0.900004

DESCRIPTION

The list DBIO::Test::AsyncParity runs. A case is a hash:

{
  no           => 7,                       # the number the run reports
  name         => 'group-by',              # what a transport declares against
  kind         => 'direct',                # direct | composed | async-only
  doc          => 'one line, what it shows',
  sync         => sub { my ($schema, $env) = @_; ... },   # the blocking way
  async        => sub { my ($schema, $env) = @_; ... },   # returns a Future
  norm         => sub { ... },             # raw result -> plain data
  observe      => sub { my ($schema) = @_; ... },         # optional
  expect_error => 1 | qr/.../,             # optional
  expect       => [ ... ],                 # async-only cases
  absent       => qr/.../,                 # optional
  requires     => [ 'pipeline', ... ],     # optional
}
kind

direct: the synchronous method has an *_async twin and the case calls that twin. composed: core has no single async method for the operation and the case composes it from the ones it has (a loop over rows, a related resultset, a transaction with a bound context). async-only: the case has no synchronous way to compare against and states what the asynchronous way must answer.

sync, async

Both receive the connected schema and $env, a hash with harness and sync_schema (a coderef returning a second, purely synchronous connection to the same database). async returns a DBIO::Future; the runner awaits it through the harness. The two ways run against the same schema instance and the same database, each after the same reset and seed.

norm

Turns what a way returned into plain data, the same code for both ways. Auto-increment keys are left out of it: the two ways run one after the other and the server hands out different ones.

observe

Reads the state the case left behind, through the synchronous path, after the way has run. Compared like a result.

expect_error

Both ways must throw, with the same exception class; a regex also has to match the message of each. Without this key a way that throws is a failure.

absent

The case documents an operation core has no asynchronous twin for. The regex is what the asynchronous way's failure must match. It is a declared absence that belongs to the table, not to a transport; when core grows the twin the case passes, the declaration is stale and the run fails until the key is removed.

requires

The capabilities of the transport the case needs: names from "parity_capabilities" in DBIO::Test::AsyncParity (pipeline, cancel, pool_queue, listen, notify, fault:rollback_fails, fault:disconnect, unreachable_connection). A transport without one of them does not run the case: it is reported skipped, naming what is missing ("Capabilities" in DBIO::Test::AsyncParity). The cases that need a fault of the transport read it from $env->{fault}->($name, @args); session-reset reads its two statements from $env->{session_sql}, and connect-error-masked gets its schema from $env->{unreachable}->().

The fixture every case runs on is "fixture": three artists, four CDs and four tracks, named, never addressed by key (a live database hands out its own). The cases that write a row of their own use OneKey, a source with no relationships, where the thing under test is the write and not a cascade.

METHODS

fixture

my $data = DBIO::Test::AsyncParity::Cases->fixture;

The seed data as { artists => [ [ name, rank ] ], cds => [ [ artist name, title, year ] ], tracks => [ [ cd title, position, title ] ] }.

cases

my $cases = DBIO::Test::AsyncParity::Cases->cases;

The arrayref of cases, in number order, a fresh copy.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.