Repository navigation
Commit 57bc8ae
Run indexer acceptance and integration specs against each ingestion format (#1412)
## Why
Protobuf ingestion should support everything JSON ingestion does. The
indexer acceptance and integration specs are the best record of what
JSON ingestion supports, but they only run against JSON. Running them
against protobuf too would show each gap as the protobuf stack closes
it.
## What
Run all indexer acceptance and integration specs once per ingestion
format, in `with json ingestion` and `with proto ingestion` contexts.
The protobuf examples are `pending` because the indexer cannot ingest
protobuf events yet.
RSpec still runs pending examples and fails any that pass. As protobuf
ingestion lands, the blanket `pending` gives way to `pending` metadata
on the examples that still fail. RSpec then flags each of those examples
as its gap closes.
## How
A new `spec_support/.../ingestion_formats.rb` provides
`for_each_ingestion_format`, which defines a context per format.
Examples keep building events with the JSON factories. They process them
through `process_indexing_events`, which calls
`round_trip_indexing_events` (and `index_records` for the derived-type
spec). For JSON, the round trip returns the events unchanged. For
protobuf, it raises `NotImplementedError` for now; the protobuf stack
will replace that with publishing to and decoding from protobuf. The
names match the harness in #1388 so the stack can rebase onto this.
The protobuf contexts build indexers from the stock schema defined with
the protobuf extension, cached once per process. `schema_evolution_spec`
dumps protobuf-only artifacts and leaves out `json_schema_version`.
The malformed-event examples in `processor_spec` run only for JSON.
Their events have wrong primitive types (e.g. `name: 17`), which a
protobuf publisher can't encode.
This also fixes the VCR hook. It skipped recording a cassette only when
`ex.exception` was set. RSpec stores the expected failure of a pending
example in `execution_result.pending_exception` instead, so failing
pending examples got recorded. After a gap closed, replaying that
cassette would fail the example with a VCR error, so it stayed pending
and RSpec never reported it fixed. I checked this locally by making the
protobuf round trip return events unchanged: before the fix, examples
stayed pending; after it, RSpec reports them `FIXED`.
## Risk
Low. Only specs and spec support change. The JSON examples are the same
52 as before.
## Testing
No manual testing. On main, the proto variants already show real gaps
beyond the stubbed round trip. Protobuf-only artifacts give "No
ingestion adapters are available". Removing a field or type doesn't
abort the dump the way the JSON schema version check does.
## Bigger picture
This follows up on Myron's suggestion to run the indexer specs against
both formats and use `pending` for the gaps. The protobuf ingestion
stack (#1405 → #1408 → #1406 → #1388) can rebase onto this, implement
`round_trip_indexing_events` for protobuf, and replace the blanket
`pending` with per-example metadata. Schema evolution for protobuf will
also need to encode old events with the old compiled descriptors.
---------
Co-authored-by: myronmarston-toast <myron.marston@toasttab.com>1 parent bcea332 commit 57bc8ae
13 files changed
Lines changed: 1840 additions & 1702 deletions
File tree
- config
- elasticgraph-indexer
- spec
- acceptance
- integration/elastic_graph/indexer
- support
- spec_support
- lib/elastic_graph/spec_support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
0 commit comments