Skip to content

fix(deps): bump io.javaoperatorsdk:operator-framework from 4.9.4 to 4.9.5 #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ jib {
}

project.ext {
mongoDbDriverVersion = "5.1.4"
mongoDbDriverVersion = "5.2.0"
slf4jVersion = "2.0.16"
operatorFrameworkVersion = "4.9.4"
operatorFrameworkVersion = "4.9.5"
kubernetesServerMockVersion = "6.13.3" // align with transitive dependency of operator framework
mockitoVersion = "5.2.0"
jacksonVersion = "2.17.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,11 @@ private String userDatabase(String accessibleDatabase) {
private boolean isOk(Document response) {
// be generous with the type: different MongoDB API implementations return different types
var okValue = response.get("ok", Object.class);
if (okValue instanceof Double okValueDouble) {
// MongoDB returns Double
return Double.compare(okValueDouble, 1.0D) == 0;
} else if (okValue instanceof Integer okValueInt) {
// AWS DocumentDB returns Integer
return okValueInt == 1;
} else {
return false;
}
return switch (okValue) {
case Double okValueDouble -> Double.compare(okValueDouble, 1.0D) == 0;
case Integer okValueInt -> okValueInt == 1;
default -> false;
};
}

boolean checkDocumentDb(ConnectionString connectionString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ void shouldStartTheController() throws IOException {
assertThatNoException()
.isThrownBy(
() -> {
//noinspection EmptyTryBlock
try (var ignored = new ServerSocket(port)) {}
try (var ignored = new ServerSocket(port)) {
LOG.info("Server stopped");
}
}));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,69 +273,6 @@ void shouldCallAllNecessaryServicesForSuccess() {
});
}

@Test
void shouldCallAllNecessaryServicesForSuccessForDocumentDb() {
var secretArgumentCaptor = ArgumentCaptor.forClass(Secret.class);
doNothing()
.when(kubernetesClientAdapterMock)
.createSecretInNamespace(anyString(), secretArgumentCaptor.capture());
when(mongoDbServiceMock.createDatabaseWithUser(anyString(), anyString(), anyString()))
.thenReturn(CreateDatabaseResult.CREATED);
when(mongoDbServiceMock.getConnectionString()).thenReturn(MONGODB_OPERATOR_CONNECTION_STRING);

var givenMongoDbCr = new MongoDbCustomResource();
givenMongoDbCr.setMetadata(
new ObjectMetaBuilder().withNamespace("the-namespace").withName("the-name").build());
givenMongoDbCr.setSpec(
new MongoDbSpec()
.setSecret(
new SecretSpec()
.setUsernameKey("u")
.setPasswordKey("p")
.setConnectionStringKey("c"))
.setDatabase(
new DatabaseSpec()
.setConnectionStringOptions(
"tls=true&readPreference=secondaryPreferred&retryWrites=false")));

var actual = mongoDbController.reconcile(givenMongoDbCr, new MongoDbCustomResourceContext());

verify(mongoDbServiceMock, times(1))
.createDatabaseWithUser(
"the-namespace_the-name", "the-namespace_the-name", "static-test-password");
verify(kubernetesClientAdapterMock, times(1))
.createSecretInNamespace(eq("the-namespace"), any(Secret.class));

assertSoftly(
softly -> {
softly
.assertThat(secretArgumentCaptor.getValue())
.extracting(Secret::getMetadata)
.extracting("namespace", "name")
.containsExactly("the-namespace", "the-name");
softly
.assertThat(secretArgumentCaptor.getValue())
.extracting(Secret::getData)
.extracting("u", "p", "c")
.containsExactly(
"dGhlLW5hbWVzcGFjZV90aGUtbmFtZQ==",
"c3RhdGljLXRlc3QtcGFzc3dvcmQ=",
"bW9uZ29kYjovL3RoZS1uYW1lc3BhY2VfdGhlLW5hbWU6c3RhdGljLXRlc3QtcGFzc3dvcmRAc29tZS1kb2N1bWVudGRiLmMxMjM0NTYuZXUtY2VudHJhbC0xLmRvY2RiLmFtYXpvbmF3cy5jb206MjcwMTcsc29tZS1kb2N1bWVudGRiLmM3ODkwMTIuZXUtY2VudHJhbC0xLmRvY2RiLmFtYXpvbmF3cy5jb206MjcwMTcvdGhlLW5hbWVzcGFjZV90aGUtbmFtZT90bHM9dHJ1ZSZyZWFkUHJlZmVyZW5jZT1zZWNvbmRhcnlQcmVmZXJyZWQmcmV0cnlXcml0ZXM9ZmFsc2U=");

// For the moment no updates to the original resource, this may change in the future if
// needed.
softly.assertThat(actual.isUpdateResource()).isFalse();
softly.assertThat(actual.isUpdateStatus()).isTrue();
softly
.assertThat(actual.getResource().getStatus().getConditions())
.isNotEmpty()
.extracting(Condition::getStatus)
.containsOnly("True");
softly.assertThat(actual.isUpdateResourceAndStatus()).isFalse();
softly.assertThat(actual.isNoUpdate()).isFalse();
});
}

@Test
void shouldFailWithBadConditionsForTooLongName() {
when(mongoDbServiceMock.getConnectionString()).thenReturn(MONGODB_OPERATOR_CONNECTION_STRING);
Expand Down
Loading