Skip to content

test: expand Java interop tests to cover all compression codecs#3423

Merged
dnwe merged 5 commits intomainfrom
dnwe/interop
Jan 11, 2026
Merged

test: expand Java interop tests to cover all compression codecs#3423
dnwe merged 5 commits intomainfrom
dnwe/interop

Conversation

@dnwe
Copy link
Copy Markdown
Collaborator

@dnwe dnwe commented Jan 11, 2026

  • add gzip, lz4 and zstd to the existing snappy interop tests
  • isolate each test's use of the shared topic
  • support kafka <2.x (different cmdline options on console utilities)

dnwe added 2 commits January 11, 2026 13:07
Conditionally set producer/consumer arguments

Signed-off-by: Dominic Evans <[email protected]>
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
stderrOutput.WriteString(scanner.Text() + "\n")
s := bufio.NewScanner(stderr)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t we have a s.Err() test as a sanity check? (If it ever happens, and we’re not reporting it, it could lead to a difficult debug.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, added

Comment on lines +267 to +268
"--offset", fmt.Sprintf("%d", startOffset),
"--max-messages", fmt.Sprintf("%d", count),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure how much of a difference this would actually make though:

Suggested change
"--offset", fmt.Sprintf("%d", startOffset),
"--max-messages", fmt.Sprintf("%d", count),
"--offset", fmt.Sprint(startOffset),
"--max-messages", fmt.Sprint(count),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

waitErr := cmd.Wait()
require.NoError(t, waitErr, "Java producer failed")
}
require.NoError(t, err)
Copy link
Copy Markdown
Member

@edoardocomar edoardocomar Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if waitErr is not nil the test failure will hide the previous err - what about

-                       require.NoError(t, waitErr, "Java producer failed")
+                       if waitErr != nil {
+                               err = fmt.Errorf("failed to write message: %w; Java producer failed: %w", err, waitErr)
+                       }
+                       require.NoError(t, err)
                }
-               require.NoError(t, err)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Copy link
Copy Markdown
Collaborator

@puellanivis puellanivis Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, if we already know we’re going to fail the NoError just put a t.Fatal in directly?

PS: I would recommend just using assert.NoError(t, waittErr) instead?

@edoardocomar
Copy link
Copy Markdown
Member

LGTM thanks @dnwe

@dnwe dnwe merged commit 91842f9 into main Jan 11, 2026
17 checks passed
@dnwe dnwe deleted the dnwe/interop branch January 11, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants