Skip to content

Commit 6c86b99

Browse files
committed
wip
Signed-off-by: Attila Mészáros <[email protected]>
1 parent e0bcba9 commit 6c86b99

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/ReconcilerUtilsTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io.fabric8.kubernetes.api.model.apps.Deployment;
99
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;
1010
import io.fabric8.kubernetes.api.model.apps.DeploymentSpec;
11+
import io.fabric8.kubernetes.api.model.apps.DeploymentStatus;
1112
import io.fabric8.kubernetes.api.model.rbac.ClusterRole;
1213
import io.fabric8.kubernetes.api.model.rbac.ClusterRoleBuilder;
1314
import io.fabric8.kubernetes.client.CustomResource;
@@ -116,6 +117,29 @@ void setsSpecCustomResourceWithReflection() {
116117
assertThat(tomcat.getSpec().getReplicas()).isEqualTo(1);
117118
}
118119

120+
@Test
121+
void setsStatusWithReflection() {
122+
Deployment deployment = new Deployment();
123+
DeploymentStatus status = new DeploymentStatus();
124+
status.setReplicas(2);
125+
126+
ReconcilerUtils.setStatus(deployment, status);
127+
128+
assertThat(deployment.getStatus().getReplicas()).isEqualTo(2);
129+
}
130+
131+
@Test
132+
void getsStatusWithReflection() {
133+
Deployment deployment = new Deployment();
134+
DeploymentStatus status = new DeploymentStatus();
135+
status.setReplicas(2);
136+
deployment.setStatus(status);
137+
138+
var res = ReconcilerUtils.getStatus(deployment);
139+
140+
assertThat(((DeploymentStatus) res).getReplicas()).isEqualTo(2);
141+
}
142+
119143
@Test
120144
void loadYamlAsBuilder() {
121145
DeploymentBuilder builder =

0 commit comments

Comments
 (0)