Skip to content

Go-SDK: exclude oversized-payload framing test from -race builds#67602

Open
jason810496 wants to merge 1 commit into
apache:mainfrom
jason810496:fix/go-sdk/frames-race-test
Open

Go-SDK: exclude oversized-payload framing test from -race builds#67602
jason810496 wants to merge 1 commit into
apache:mainfrom
jason810496:fix/go-sdk/frames-race-test

Conversation

@jason810496
Copy link
Copy Markdown
Member

Why

go test -race ./pkg/execution/ currently fatals before any test in the package can run.

TestWriteFrameRejectsOversizedPayload constructs a 4 GiB+ slice with unsafe.Slice(&backing, MaxFrameSize+1) to exercise writeFrame's size guard cheaply, and the checkptr instrumentation that -race enables treats the resulting "slice straddles allocations" as a fatal violation.

The existing strconv.IntSize runtime skip does not help, checkptr fires inside unsafe.Slice itself, before any t.Skip could run.

What

  • Move TestWriteFrameRejectsOversizedPayload out of frames_test.go into a new file frames_oversized_test.go carrying //go:build !race, so the file (and the unsafe.Slice call inside it) is excluded from the build under -race.
  • Drop the now-unused strconv and unsafe imports from frames_test.go.

Verification

  1. Non-race build still exercises the test.

    $ go test -run TestWriteFrameRejectsOversizedPayload -v ./pkg/execution/
    === RUN   TestWriteFrameRejectsOversizedPayload
    --- PASS: TestWriteFrameRejectsOversizedPayload (0.00s)
    PASS
    ok  	github.com/apache/airflow/go-sdk/pkg/execution	0.171s
    
  2. Race build skips the test (no checkptr fatal).

    $ go test -race -run TestWriteFrameRejectsOversizedPayload -v ./pkg/execution/
    testing: warning: no tests to run
    PASS
    ok  	github.com/apache/airflow/go-sdk/pkg/execution	1.235s [no tests to run]
    
  3. Whole package now passes under -race (previously fatal):

    $ go test -race ./pkg/execution/
    ok  	github.com/apache/airflow/go-sdk/pkg/execution	1.823s
    

Was generative AI tooling used to co-author this PR?

TestWriteFrameRejectsOversizedPayload uses unsafe.Slice with a
length greater than MaxFrameSize on a single-byte backing array to
exercise writeFrame's size guard without actually allocating 4 GiB.
Under -race, Go's checkptr instrumentation treats the resulting
slice as straddling allocations and fatals the entire test binary,
which currently prevents go test -race from running on the
pkg/execution package at all.

Move the test into its own file gated by //go:build !race so the
non-race build keeps the coverage and the race build skips it. The
guard under test is a single len() comparison; losing race-mode
coverage on that one path is acceptable to keep the rest of the
package's race tests runnable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant