cockroachdb / cockroachdb/cockroach

logictest: support block-level skipif/onlyif for subtests

Open
#170,758 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement O-agent T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Currently `skipif`/`onlyif` applies only to the immediately following directive. To skip an entire subtest, you must repeat the same `skipif` before every `statement` or `query`, e.g.:

```
subtest enable_disable_trigger

skipif config local-mixed-25.4 local-mixed-26.1
statement ok
CREATE TABLE t (a INT);

skipif config local-mixed-25.4 local-mixed-26.1
statement ok
CREATE FUNCTION f() ...

# ... repeated 30+ more times
```

This is a real maintenance burden. Across the logictest suite, 35% of all `skipif`/`onlyif` directives (645 of 1,861) are part of 3+ consecutive identical repetitions spanning 53 files. The worst cases are `triggers` (69 consecutive identical `skipif` lines in one subtest) and `statement_hint_builtins` (63).

Proposal: allow `skipif`/`onlyif` immediately after a `subtest` directive to apply to the entire subtest block, so the above becomes:

```
subtest enable_disable_trigger
skipif config local-mixed-25.4 local-mixed-26.1

statement ok
CREATE TABLE t (a INT);

statement ok
CREATE FUNCTION f() ...
```

Jira issue: CRDB-64160

Contributor guide

Open the contributing guide

Research direction

Start by locating the logictest handling for subtest, skipif, and onlyif directives, then inspect how statement and query entries are grouped into subtest blocks. Implement the proposed block-level behavior and verify that repeated directives are no longer required while existing directive behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.