Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sample-operators/mysql-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
<artifactId>operator-framework-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private Connection getConnection() throws SQLException {

@Override
public void delete(MySQLSchema primary, Context<MySQLSchema> context) {
log.debug("Deleting schema");
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The new debug log line is quite generic and may not help diagnose which resource is being deleted during flaky runs. Consider including identifying details (e.g., schema name/namespace and possibly username/secret when available) so the log can be correlated to a specific reconciliation/deletion event.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that those are already included from MDC

try (Connection connection = getConnection()) {
var userName = primary.getStatus() != null ? primary.getStatus().getUserName() : null;
SchemaService.deleteSchemaAndRelatedUser(
Expand Down
5 changes: 4 additions & 1 deletion sample-operators/mysql-schema/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<Logger level="debug" name="io.javaoperatorsdk.operator" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@
import io.javaoperatorsdk.operator.sample.dependent.SchemaDependentResource;

import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;

class MySQLSchemaOperatorE2E {

Expand Down Expand Up @@ -114,10 +110,10 @@ void test() {
.inNamespace(operator.getNamespace())
.withName(testSchema.getMetadata().getName())
.get();
assertThat(updatedSchema.getStatus(), is(notNullValue()));
assertThat(updatedSchema.getStatus().getStatus(), equalTo("CREATED"));
assertThat(updatedSchema.getStatus().getSecretName(), is(notNullValue()));
assertThat(updatedSchema.getStatus().getUserName(), is(notNullValue()));
assertThat(updatedSchema.getStatus()).isNotNull();
assertThat(updatedSchema.getStatus().getStatus()).isEqualTo("CREATED");
assertThat(updatedSchema.getStatus().getSecretName()).isNotNull();
assertThat(updatedSchema.getStatus().getUserName()).isNotNull();
});

client
Expand All @@ -137,7 +133,7 @@ void test() {
.inNamespace(operator.getNamespace())
.withName(testSchema.getMetadata().getName())
.get();
assertThat(updatedSchema, is(nullValue()));
assertThat(updatedSchema).isNull();
});
}
}