Skip to content

Commit b60b3e6

Browse files
author
Vince Kraemer
committed
address comments from Russ
1 parent 239a19b commit b60b3e6

File tree

5 files changed

+43
-14
lines changed

5 files changed

+43
-14
lines changed

model/src/test/java/oracle/kubernetes/weblogic/domain/v2/AdminServerTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,27 @@ public void whenExportedAccessPointsDifferByAnnotation_objectsAreNotEqual() {
6161
}
6262

6363
@Test
64-
public void nodePortTests() {
64+
public void whenNodePortAnnotationsDiffer_objectsAreNotEqual() {
6565
server1.addNodePortAnnotations("key", "value");
6666
assertThat(server1, not(equalTo(server2)));
67+
}
68+
69+
@Test
70+
public void whenNodePortAnnotationsAreSame_objectsAreEqual() {
71+
server1.addNodePortAnnotations("key", "value");
6772
server2.addNodePortAnnotations("key", "value");
6873
assertThat(server1, equalTo(server2));
74+
}
75+
76+
@Test
77+
public void whenNodePortLabelsDiffer_hashCodesAreNotEqual() {
6978
server1.addNodePortLabels("key", "value");
7079
assertThat(server1.hashCode(), not(equalTo(server2.hashCode())));
80+
}
81+
82+
@Test
83+
public void whenNodePortLabelsAreSame_hashCodesAreEqual() {
84+
server1.addNodePortLabels("key", "value");
7185
server2.addNodePortLabels("key", "value");
7286
assertThat(server1.hashCode(), equalTo(server2.hashCode()));
7387
}

model/src/test/java/oracle/kubernetes/weblogic/domain/v2/BaseConfigurationTestBase.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,27 @@ private V1EnvVar env(String name, String value) {
8686
}
8787

8888
@Test
89-
public void serviceLabelAndAnnotation() {
89+
public void whenServiceLabelsDiffer_objectsAreNotEqual() {
9090
instance1.addServiceLabels("key", "value");
9191
assertThat(instance1, not(equalTo(instance2)));
92+
}
93+
94+
@Test
95+
public void whenServiceLabelsDoNotDiffer_objectsAreEqual() {
96+
instance1.addServiceLabels("key", "value");
9297
instance2.addServiceLabels("key", "value");
9398
assertThat(instance1, equalTo(instance2));
99+
}
100+
101+
@Test
102+
public void whenserviceAnnotationsDiffer_hashCodesAreNotEqual() {
94103
instance1.addServiceAnnotations("key", "value");
95104
assertThat(instance1.hashCode(), not(equalTo(instance2.hashCode())));
105+
}
106+
107+
@Test
108+
public void whenserviceAnnotationsDoNotDiffer_hashCodesAreEqual() {
109+
instance1.addServiceAnnotations("key", "value");
96110
instance2.addServiceAnnotations("key", "value");
97111
assertThat(instance1.hashCode(), equalTo(instance2.hashCode()));
98112
}

model/src/test/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Test.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,10 +1105,10 @@ public void whenDomain2ReadFromYaml_AdminServerInheritPodSecurityContextFromDoma
11051105
}
11061106

11071107
@Test
1108-
public void whenDomain2ReadFromYaml_serviceLabelsAndAnnotations() throws IOException {
1108+
public void whenDomain2ReadFromYaml_serviceAnnotationsFound() throws IOException {
11091109
Domain domain = readDomain(DOMAIN_V2_SAMPLE_YAML_2);
11101110
ServerSpec serverSpec = domain.getServer("server2", "cluster1");
1111-
assertThat(serverSpec.getServiceAnnotations(), hasEntry("e", "f"));
1111+
assertThat(serverSpec.getServiceAnnotations(), hasEntry("testKey3", "testValue3"));
11121112
}
11131113

11141114
@Test
@@ -1149,9 +1149,10 @@ public void whenDomain3ReadFromYaml_adminServerHasNodeSelector() throws IOExcept
11491149
@Test
11501150
public void whenDomain3ReadFromYaml_adminServerHasAnnotationsAndLabels() throws IOException {
11511151
Domain domain = readDomain(DOMAIN_V2_SAMPLE_YAML_3);
1152-
assertThat(domain.getAdminServerSpec().getServiceAnnotations(), hasEntry("e", "f"));
1153-
assertThat(domain.getAdminServerSpec().getServiceLabels(), hasEntry("a", "b"));
1154-
assertThat(domain.getAdminServerSpec().getServiceLabels(), hasEntry("c", "d"));
1152+
assertThat(
1153+
domain.getAdminServerSpec().getServiceAnnotations(), hasEntry("testKey3", "testValue3"));
1154+
assertThat(domain.getAdminServerSpec().getServiceLabels(), hasEntry("testKey1", "testValue1"));
1155+
assertThat(domain.getAdminServerSpec().getServiceLabels(), hasEntry("testKey2", "testValue2"));
11551156
}
11561157

11571158
@Test

model/src/test/resources/oracle/kubernetes/weblogic/domain/v2/domain-sample-2.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ spec:
7878
nodeSelector:
7979
os: linux
8080
serviceLabels:
81-
a: b
82-
c: d
81+
testKey1: testValue1
82+
testKey2: testValue2
8383
podSecurityContext:
8484
runAsGroup: 421
8585
runAsNonRoot: true
@@ -111,8 +111,8 @@ spec:
111111
nodeSelector:
112112
os_type: oel7
113113
serviceAnnotations:
114-
a: b
115-
e: f
114+
testKey3: testValue3
115+
testKey4: testValue4
116116
podSecurityContext:
117117
runAsGroup: 422
118118
seLinuxOptions:

model/src/test/resources/oracle/kubernetes/weblogic/domain/v2/domain-sample-3.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ spec:
3333
nodeSelector:
3434
os: linux
3535
serviceLabels:
36-
a: b
37-
c: d
36+
testKey1: testValue1
37+
testKey2: testValue2
3838
serviceAnnotations:
39-
e: f
39+
testKey3: testValue3
4040
longer: shorter
4141

4242
domainName: base_domain

0 commit comments

Comments
 (0)