Skip to content

Commit

Permalink
review: style checks
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Jan 16, 2025
1 parent 00aaf5b commit 65a3ab0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ public static List<Object> requestPayLoadForRolloutRestart() {
HashMap<String, Object> value = new HashMap<>();
patch.put("op", "replace");
patch.put("path", "/spec/template/metadata/annotations");
value.put("kubectl.kubernetes.io/restartedAt", new Date().toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
patch.put("value", value);
value.put("kubectl.kubernetes.io/restartedAt",
new Date().toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
patch.put("value", value);
return Collections.singletonList(patch);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ void testReplace() {
void testPause() {
// Given
Deployment deployment1 = new DeploymentBuilder().withNewMetadata()
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.endSpec()
.build();
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.endSpec()
.build();
client.apps().deployments().inNamespace("ns1").create(deployment1);

// When
client.apps()
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.pause();
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.pause();
Deployment updatedDeployment = client.apps().deployments().inNamespace("ns1").withName("d1").get();

// Then
Expand All @@ -160,23 +160,23 @@ void testPause() {
void testRolloutResume() throws InterruptedException {
// Given
Deployment deployment1 = new DeploymentBuilder().withNewMetadata()
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.withPaused(true)
.endSpec()
.build();
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.withPaused(true)
.endSpec()
.build();
client.apps().deployments().inNamespace("ns1").create(deployment1);

// When
client.apps()
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.resume();
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.resume();
Deployment updatedDeployment = client.apps().deployments().inNamespace("ns1").withName("d1").get();

// Then
Expand All @@ -189,31 +189,32 @@ void testRolloutResume() throws InterruptedException {
void testRolloutRestart() throws InterruptedException {
// Given
Deployment deployment1 = new DeploymentBuilder().withNewMetadata()
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.withNewTemplate()
.withNewMetadata()
.addToAnnotations("", "")
.endMetadata()
.endTemplate()
.endSpec()
.build();
.withName("d1")
.withNamespace("ns1")
.addToLabels("testKey", "testValue")
.endMetadata()
.withNewSpec()
.withNewTemplate()
.withNewMetadata()
.addToAnnotations("", "")
.endMetadata()
.endTemplate()
.endSpec()
.build();
client.apps().deployments().inNamespace("ns1").create(deployment1);

// When
client.apps()
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.restart();
.deployments()
.inNamespace("ns1")
.withName("d1")
.rolling()
.restart();
Deployment updatedDeployment = client.apps().deployments().inNamespace("ns1").withName("d1").get();

// Then
assertNotNull(updatedDeployment);
assertNotNull(updatedDeployment.getSpec().getTemplate().getMetadata().getAnnotations().get("kubectl.kubernetes.io/restartedAt"));
assertNotNull(
updatedDeployment.getSpec().getTemplate().getMetadata().getAnnotations().get("kubectl.kubernetes.io/restartedAt"));
}
}

0 comments on commit 65a3ab0

Please sign in to comment.