DRDataRaft/ docs
GitHub ↗

dr_test_adapter()

Checks preflight, descriptive metadata and the five standard capabilities. NA capability values are allowed as undeclared; they do not trigger I/O. Source adapters are read and compared with expected when provided. Target adapters are written only when data and an explicit context$contract are supplied. Use a disposable target: this helper performs real I/O. A read_back callback reads the committed result for a roundtrip comparison. This smoke test cannot certify transactionality, concurrency, secret hygiene or remote failure recovery. Test those guarantees separately in your adapter.

Usage

dr_test_adapter(
  adapter,
  expected = NULL,
  data = NULL,
  context = list(),
  read_back = NULL,
  failure_probe = NULL,
  read_committed = NULL
)

Arguments

adapter
Source or target adapter.


expected
Optional expected source or roundtrip data frame.


data
Optional data frame to write to a target.


context
Target context including an explicit contract.


read_back
Optional function accepting the write result and returning the committed table. Required when testing a target write.


failure_probe
Optional function(adapter, data, context) injecting an error after staging or during commit. Use only disposable external resources.


read_committed
Zero-argument function returning committed state before and after failure_probe. Required together with failure_probe.

Value

Invisibly, a list with capabilities, descriptor, read and write results. Protocol violations raise dr_adapter_nonconformant; adapter execution errors retain their original classes.

Examples

dr_test_adapter(data.frame(id = 1:2), expected = data.frame(id = 1:2))
Documentation source snapshot · View source at 2f9432d ↗
Code examples are documented source examples; they are not executed in this website build.

Search documentation

Search functions, packages and guides.