File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
operator-framework-core/src/test/java/io/javaoperatorsdk/operator Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 88import io .fabric8 .kubernetes .api .model .apps .Deployment ;
99import io .fabric8 .kubernetes .api .model .apps .DeploymentBuilder ;
1010import io .fabric8 .kubernetes .api .model .apps .DeploymentSpec ;
11+ import io .fabric8 .kubernetes .api .model .apps .DeploymentStatus ;
1112import io .fabric8 .kubernetes .api .model .rbac .ClusterRole ;
1213import io .fabric8 .kubernetes .api .model .rbac .ClusterRoleBuilder ;
1314import 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 =
You can’t perform that action at this time.
0 commit comments