Skip to content

Conversation

@freeznet
Copy link
Member

Fixes #368

Motivation

Avoid repeated reconcile failures when topics already exist and prevent schema updates from churning on empty schema.

Modifications

Improve already-exists detection and add e2e coverage for pre-existing topics and empty schema version stability.

Verifying this change

This change added tests and can be verified as follows:

  • go test ./pkg/admin/... -v -run TestIsAlreadyExist
  • cd tests && ginkgo --trace --progress ./operator

Documentation

  • no-need-doc (tests and error handling only)

@freeznet freeznet requested review from a team as code owners January 13, 2026 03:25
@github-actions
Copy link
Contributor

@freeznet:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added the doc-info-missing This pr needs to mark a document option in description label Jan 13, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 455 files.

Valid Invalid Ignored Fixed
363 1 91 0
Click to see the invalid file list
  • pkg/admin/errors_test.go

@freeznet freeznet requested a review from Copilot January 14, 2026 15:08
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error handling for already-existing Pulsar resources and adds end-to-end test coverage for pre-existing topics and schema version stability. The changes prevent unnecessary reconcile failures and schema version churn.

Changes:

  • Enhanced IsAlreadyExist error detection to handle multiple error formats and HTTP status codes
  • Refactored schema application logic to compare versions and avoid unnecessary uploads
  • Added comprehensive unit and e2e tests for pre-existing topics and empty schema handling

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/admin/errors.go Improved IsAlreadyExist to handle wrapped errors and string matching for "already exist" messages
pkg/admin/errors_test.go Added comprehensive test coverage for IsAlreadyExist function
pkg/admin/interface.go Added GetSchemaInfoWithVersion and GetSchemaVersionBySchemaInfo methods to the interface
pkg/admin/impl.go Implemented new schema version checking methods
pkg/admin/dummy.go Added stub implementations for testing
pkg/connection/reconcile_topic.go Refactored applySchema to use version comparison instead of deep equality
pkg/connection/reconcile_topic_test.go Added unit tests for schema application logic
tests/operator/resources_test.go Added e2e tests for pre-existing topics and empty schema version stability
.gitignore Added mise.toml to ignored files
Comments suppressed due to low confidence (1)

pkg/admin/errors_test.go:1

  • The copyright header is duplicated at the beginning of the file. Remove the duplicate copyright header (lines 15-27).
// Copyright 2026 StreamNative

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@freeznet freeznet merged commit 94db423 into main Jan 15, 2026
5 checks passed
@freeznet freeznet deleted the freeznet/jakarta branch January 15, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-info-missing This pr needs to mark a document option in description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After upgrading operator it tries to recreate topics that already exist

3 participants