|
4 | 4 |
|
5 | 5 | package oracle.kubernetes.operator.helpers;
|
6 | 6 |
|
7 |
| -import static oracle.kubernetes.operator.Workarounds.INTORSTRING_BAD_EQUALS; |
8 |
| - |
9 | 7 | import com.meterware.simplestub.Memento;
|
10 | 8 | import com.meterware.simplestub.StaticStubSupport;
|
11 | 9 | import io.kubernetes.client.ApiClient;
|
12 | 10 | import io.kubernetes.client.ApiException;
|
13 |
| -import io.kubernetes.client.models.V1beta1Ingress; |
14 | 11 | import java.net.HttpURLConnection;
|
15 | 12 | import java.util.ArrayList;
|
16 | 13 | import java.util.Collections;
|
|
24 | 21 | import oracle.kubernetes.operator.calls.RequestParams;
|
25 | 22 | import oracle.kubernetes.operator.calls.SynchronousCallDispatcher;
|
26 | 23 | import oracle.kubernetes.operator.calls.SynchronousCallFactory;
|
27 |
| -import oracle.kubernetes.operator.utils.YamlUtils; |
28 | 24 |
|
29 | 25 | /**
|
30 | 26 | * Support for writing unit tests that use CallBuilder to send requests that expect responses.
|
@@ -163,31 +159,10 @@ private boolean matches(RequestParams requestParams) {
|
163 | 159 |
|
164 | 160 | private boolean matchesBody(Object actualBody, Object expectedBody) {
|
165 | 161 | return expectedBody instanceof BodyMatcher && ((BodyMatcher) expectedBody).matches(actualBody)
|
166 |
| - || equalBodies(actualBody, expectedBody) |
| 162 | + || Objects.equals(actualBody, expectedBody) |
167 | 163 | || function != null;
|
168 | 164 | }
|
169 | 165 |
|
170 |
| - private static boolean equalBodies(Object actual, Object expected) { |
171 |
| - return useYamlComparison(actual) |
172 |
| - ? yamlEquals(actual, expected) |
173 |
| - : Objects.equals(actual, expected); |
174 |
| - } |
175 |
| - |
176 |
| - // This is a hack to get around a bug in the 1.0 K8s client code: |
177 |
| - // the IntOrString class does not define equals(), meaning that any classes which depend on |
178 |
| - // it require special handling. |
179 |
| - private static boolean useYamlComparison(Object actual) { |
180 |
| - return INTORSTRING_BAD_EQUALS && actual instanceof V1beta1Ingress; |
181 |
| - } |
182 |
| - |
183 |
| - private static boolean yamlEquals(Object actual, Object expected) { |
184 |
| - return Objects.equals(objectToYaml(actual), objectToYaml(expected)); |
185 |
| - } |
186 |
| - |
187 |
| - private static String objectToYaml(Object object) { |
188 |
| - return YamlUtils.newYaml().dump(object); |
189 |
| - } |
190 |
| - |
191 | 166 | private boolean matches(AdditionalParams params) {
|
192 | 167 | return Objects.equals(params.fieldSelector, requestParamExpectations.get(FIELD_SELECTOR))
|
193 | 168 | && Objects.equals(params.labelSelector, requestParamExpectations.get(LABEL_SELECTOR));
|
|
0 commit comments