From 9f4ae4a7ec2e712616763518ceb03d394157ae93 Mon Sep 17 00:00:00 2001 From: Steve Hawkins Date: Mon, 31 Jul 2023 14:03:34 -0400 Subject: [PATCH] adding support for new list options Closes #5368 --- CHANGELOG.md | 2 + .../dsl/internal/AbstractWatchManager.java | 2 +- .../client/dsl/internal/BaseOperation.java | 35 +++--------- .../internal/AbstractWatchManagerTest.java | 3 ++ .../dsl/internal/BaseOperationTest.java | 34 +++++++++--- .../client/mock/CustomResourceTest.java | 17 +++--- .../mock/DefaultSharedIndexInformerTest.java | 53 ++++++++++--------- .../kubernetes/client/mock/InformTest.java | 16 +++--- .../client/mock/NodeMetricsTest.java | 2 +- .../client/mock/PodMetricsTest.java | 2 +- .../kubernetes/client/mock/PodTest.java | 4 +- .../client/mock/ResourceListTest.java | 12 ++--- .../kubernetes/client/mock/ResourceTest.java | 26 ++++----- .../kubernetes/client/mock/WatchTest.java | 16 +++--- 14 files changed, 113 insertions(+), 111 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a481576fb..6d81b320a1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,14 @@ #### Bugs #### Improvements +* Fix #5368: added support for additional ListOptions fields #### Dependency Upgrade #### New Features #### _**Note**_: Breaking changes +* Fix #5368: ListOptions parameter ordering is now alphabetical. If you are using non-crud mocking for lists with options, you may need to update your parameter order. ### 6.8.0 (2023-07-24) diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java index 5422cf6d03c..b6e10849b2d 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java @@ -301,7 +301,7 @@ void updateResourceVersion(final String newResourceVersion) { */ protected void startWatch() { listOptions.setResourceVersion(resourceVersion.get()); - URL url = BaseOperation.appendListOptionParams(requestUrl, listOptions); + URL url = this.baseOperation.appendListOptionParams(requestUrl, listOptions); String origin = requestUrl.getProtocol() + "://" + requestUrl.getHost(); if (requestUrl.getPort() != -1) { diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperation.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperation.java index f235355da3a..2f7d7c285d1 100755 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperation.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperation.java @@ -78,6 +78,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.TreeMap; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.Executor; @@ -1015,41 +1016,17 @@ private DefaultSharedIndexInformer createInformer(long resync, Executor ex return informer; } - public static URL appendListOptionParams(URL base, ListOptions listOptions) { + public URL appendListOptionParams(URL base, ListOptions listOptions) { if (listOptions == null) { return base; } URLBuilder urlBuilder = new URLBuilder(base); - if (listOptions.getLimit() != null) { - urlBuilder.addQueryParameter("limit", listOptions.getLimit().toString()); - } - if (listOptions.getContinue() != null) { - urlBuilder.addQueryParameter("continue", listOptions.getContinue()); - } - - if (listOptions.getFieldSelector() != null) { - urlBuilder.addQueryParameter("fieldSelector", listOptions.getFieldSelector()); - } - - if (listOptions.getLabelSelector() != null) { - urlBuilder.addQueryParameter("labelSelector", listOptions.getLabelSelector()); - } - if (listOptions.getResourceVersion() != null) { - urlBuilder.addQueryParameter("resourceVersion", listOptions.getResourceVersion()); - } - - if (listOptions.getTimeoutSeconds() != null) { - urlBuilder.addQueryParameter("timeoutSeconds", listOptions.getTimeoutSeconds().toString()); - } + Map values = getKubernetesSerialization().convertValue(listOptions, TreeMap.class); + values.remove("apiVersion"); + values.remove("kind"); + values.forEach((k, v) -> urlBuilder.addQueryParameter(k, v.toString())); - if (listOptions.getAllowWatchBookmarks() != null) { - urlBuilder.addQueryParameter("allowWatchBookmarks", listOptions.getAllowWatchBookmarks().toString()); - } - - if (listOptions.getWatch() != null) { - urlBuilder.addQueryParameter(WATCH, listOptions.getWatch().toString()); - } return urlBuilder.build(); } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManagerTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManagerTest.java index 6d079ce323f..525f9d53377 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManagerTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManagerTest.java @@ -22,6 +22,7 @@ import io.fabric8.kubernetes.client.WatcherException; import io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager.WatchRequestState; import io.fabric8.kubernetes.client.utils.CommonThreadPool; +import io.fabric8.kubernetes.client.utils.KubernetesSerialization; import io.fabric8.kubernetes.client.utils.Utils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -285,6 +286,8 @@ public void onClose() { static BaseOperation mockOperation() { BaseOperation operation = mock(BaseOperation.class, Mockito.RETURNS_DEEP_STUBS); Mockito.when(operation.getOperationContext().getExecutor()).thenReturn(Runnable::run); + Mockito.when(operation.getKubernetesSerialization()).thenReturn(new KubernetesSerialization()); + Mockito.when(operation.appendListOptionParams(Mockito.any(), Mockito.any())).thenCallRealMethod(); return operation; } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperationTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperationTest.java index 043a4485c61..0703c7f8bc8 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperationTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/BaseOperationTest.java @@ -34,6 +34,7 @@ import io.fabric8.kubernetes.client.http.TestHttpResponse; import io.fabric8.kubernetes.client.impl.BaseClient; import io.fabric8.kubernetes.client.utils.CommonThreadPool; +import io.fabric8.kubernetes.client.utils.KubernetesSerialization; import io.fabric8.kubernetes.client.utils.Serialization; import io.fabric8.kubernetes.client.utils.URLUtils; import io.fabric8.kubernetes.client.utils.Utils; @@ -132,7 +133,13 @@ void testChainingGracePeriodAndPropagationPolicy() { void testListOptions() throws MalformedURLException { // Given URL url = new URL("https://172.17.0.2:8443/api/v1/namespaces/default/pods"); - final BaseOperation> operation = new BaseOperation<>(new OperationContext()); + final BaseOperation> operation = new BaseOperation>( + new OperationContext()) { + @Override + public KubernetesSerialization getKubernetesSerialization() { + return new KubernetesSerialization(); + } + }; // When and Then assertEquals(URLUtils.join(url.toString(), "?limit=5"), @@ -141,20 +148,20 @@ void testListOptions() throws MalformedURLException { .build()).toString()); assertEquals( URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ"), + "?continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&limit=5"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&fieldSelector=status.phase%3DRunning"), + "?continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&fieldSelector=status.phase%3DRunning&limit=5"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") .withFieldSelector("status.phase=Running") .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&fieldSelector=status.phase%3DRunning&resourceVersion=210448"), + "?continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&fieldSelector=status.phase%3DRunning&limit=5&resourceVersion=210448"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") @@ -162,7 +169,7 @@ void testListOptions() throws MalformedURLException { .withResourceVersion("210448") .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&resourceVersion=210448"), + "?continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&limit=5&resourceVersion=210448"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") @@ -170,7 +177,7 @@ void testListOptions() throws MalformedURLException { .withResourceVersion("210448") .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&resourceVersion=210448&timeoutSeconds=10"), + "?continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&limit=5&resourceVersion=210448&timeoutSeconds=10"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") @@ -179,7 +186,7 @@ void testListOptions() throws MalformedURLException { .withTimeoutSeconds(10L) .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&resourceVersion=210448&timeoutSeconds=10&allowWatchBookmarks=true"), + "?allowWatchBookmarks=true&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&limit=5&resourceVersion=210448&timeoutSeconds=10"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") @@ -189,7 +196,7 @@ void testListOptions() throws MalformedURLException { .withAllowWatchBookmarks(true) .build()).toString()); assertEquals(URLUtils.join(url.toString(), - "?limit=5&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&resourceVersion=210448&timeoutSeconds=10&allowWatchBookmarks=true&watch=true"), + "?allowWatchBookmarks=true&continue=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ&labelSelector=%21node-role.kubernetes.io%2Fmaster&limit=5&resourceVersion=210448&timeoutSeconds=10&watch=true"), operation.fetchListUrl(url, new ListOptionsBuilder() .withLimit(5L) .withContinue("eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MjE0NDUzLCJzdGFydCI6ImV0Y2QtbWluaWt1YmVcdTAwMDAifQ") @@ -208,6 +215,17 @@ void testListOptions() throws MalformedURLException { assertEquals(URLUtils.join(url.toString(), "?watch=true"), operation.fetchListUrl(url, new ListOptionsBuilder() .withWatch(true) .build()).toString()); + // taken from the example showing how to use send initial events + assertEquals( + URLUtils.join(url.toString(), + "?allowWatchBookmarks=true&resourceVersion=&resourceVersionMatch=NotOlderThan&sendInitialEvents=true&watch=true"), + operation.fetchListUrl(url, new ListOptionsBuilder() + .withWatch(true) + .withSendInitialEvents() + .withAllowWatchBookmarks() + .withResourceVersion("") + .withResourceVersionMatch("NotOlderThan") + .build()).toString()); } @Test diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CustomResourceTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CustomResourceTest.java index 9c49a5408b3..e6bb9e3a07f 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CustomResourceTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/CustomResourceTest.java @@ -430,8 +430,8 @@ public void onClose(WatcherException cause) { void testWatchSingleResource() throws IOException, InterruptedException { // Given server.expect() - .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos" + "?fieldSelector=" - + Utils.toUrlEncoded("metadata.name=example-hello") + "&allowWatchBookmarks=true&watch=true") + .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos" + "?allowWatchBookmarks=true&fieldSelector=" + + Utils.toUrlEncoded("metadata.name=example-hello") + "&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_PERIOD) @@ -464,8 +464,8 @@ public void onClose(WatcherException cause) { void testWatchWithLabels() throws IOException, InterruptedException { // Given server.expect() - .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?labelSelector=" + Utils.toUrlEncoded("foo=bar") - + "&allowWatchBookmarks=true&watch=true") + .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?allowWatchBookmarks=true&labelSelector=" + + Utils.toUrlEncoded("foo=bar") + "&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_PERIOD) @@ -498,8 +498,9 @@ void testWatchSomeResourceVersion() throws IOException, InterruptedException { // Given String watchResourceVersion = "1001"; server.expect() - .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?resourceVersion=" + watchResourceVersion - + "&allowWatchBookmarks=true&watch=true") + .withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?allowWatchBookmarks=true&resourceVersion=" + + watchResourceVersion + + "&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_PERIOD) @@ -533,7 +534,7 @@ public void onClose(WatcherException cause) { void testWatchWithListOptions() throws IOException, InterruptedException { // Given server.expect().withPath( - "/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?resourceVersion=1003&timeoutSeconds=30&allowWatchBookmarks=true&watch=true") + "/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?allowWatchBookmarks=true&resourceVersion=1003&timeoutSeconds=30&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_PERIOD) @@ -570,7 +571,7 @@ public void onClose(WatcherException cause) { void testWatchWithNamespaceAndListOptions() throws IOException, InterruptedException { // Given server.expect().withPath( - "/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?resourceVersion=1003&timeoutSeconds=30&allowWatchBookmarks=true&watch=true") + "/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos?allowWatchBookmarks=true&resourceVersion=1003&timeoutSeconds=30&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_PERIOD) diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DefaultSharedIndexInformerTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DefaultSharedIndexInformerTest.java index 5cdfdadc809..3412b68ed62 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DefaultSharedIndexInformerTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DefaultSharedIndexInformerTest.java @@ -128,8 +128,8 @@ void testNamespacedPodInformer() throws InterruptedException { .once(); server.expect() .withPath( - "/api/v1/namespaces/test/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -187,9 +187,9 @@ void testInformerWithNamespaceAndNameConfigured() throws InterruptedException { .andReturn(200, getList(startResourceVersion, Pod.class)) .once(); server.expect() - .withPath("/api/v1/namespaces/test/pods?fieldSelector=" + Utils.toUrlEncoded("metadata.name=pod1") - + "&resourceVersion=" - + startResourceVersion + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath( + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=" + Utils.toUrlEncoded("metadata.name=pod1") + + "&resourceVersion=" + startResourceVersion + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -253,8 +253,8 @@ void testAllNamespacedInformer() throws InterruptedException { .build()) .once(); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -316,8 +316,8 @@ void shouldReconnectInCaseOf410() throws InterruptedException { .build()) .once(); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -347,8 +347,8 @@ void shouldReconnectInCaseOf410() throws InterruptedException { .build()) .times(2); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + mid2ResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + mid2ResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -404,8 +404,8 @@ void shouldDeleteIfMissingOnResync() throws InterruptedException { .build()) .once(); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -471,8 +471,8 @@ void testHasSynced() { .once(); server.expect() .withPath( - "/api/v1/namespaces/test/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -978,8 +978,8 @@ void testReconnectAfterOnCloseException() throws InterruptedException { .endMetadata() .build(); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -1008,8 +1008,8 @@ void testReconnectAfterOnCloseException() throws InterruptedException { // should pick this up after the termination server.expect() - .withPath("/api/v1/pods?resourceVersion=" + midResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + midResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -1080,8 +1080,8 @@ void terminalExceptionWhenWatchFailsIsPropagatedToStopped() { .build()) .once(); server.expect() - .withPath("/api/v1/pods?resourceVersion=" + startResourceVersion - + "&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/pods?allowWatchBookmarks=true&resourceVersion=" + startResourceVersion + + "&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(WATCH_EVENT_EMIT_TIME) @@ -1256,12 +1256,13 @@ private void setupMockServerExpectationsWithVersion(Clas url += ("/" + HasMetadata.getPlural(resourceClass)); URLUtils.URLBuilder builder = new URLUtils.URLBuilder(url); - if (labelSelector != null) { - builder.addQueryParameter("labelSelector", labelSelector); - } if (fieldSelector != null) { builder.addQueryParameter("fieldSelector", fieldSelector); } + if (labelSelector != null) { + builder.addQueryParameter("labelSelector", labelSelector); + } + String watchUrl = builder.toString(); builder.addQueryParameter("resourceVersion", "0"); String listUrl = builder.toString(); @@ -1271,9 +1272,9 @@ private void setupMockServerExpectationsWithVersion(Clas .once(); URLBuilder watchBuilder = new URLUtils.URLBuilder(watchUrl); - watchUrl = watchBuilder.addQueryParameter("resourceVersion", startResourceVersion) + watchUrl = watchBuilder.addQueryParameter("allowWatchBookmarks", "true") + .addQueryParameter("resourceVersion", startResourceVersion) .addQueryParameter("timeoutSeconds", "600") - .addQueryParameter("allowWatchBookmarks", "true") .addQueryParameter("watch", "true") .toString(); server.expect() diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/InformTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/InformTest.java index 60636c933ab..cc83ec6d279 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/InformTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/InformTest.java @@ -74,7 +74,7 @@ void testInformPodWithLabel() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?labelSelector=my-label&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&labelSelector=my-label&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -128,7 +128,7 @@ void testInformGeneric() throws InterruptedException { server.expect() .withPath( - "/apis/demos.fabric8.io/v1/namespaces/test/dummies?labelSelector=my-label&resourceVersion=2&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/apis/demos.fabric8.io/v1/namespaces/test/dummies?allowWatchBookmarks=true&labelSelector=my-label&resourceVersion=2&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -196,7 +196,7 @@ void testGenericWithKnownType() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -261,7 +261,7 @@ void testRunnableInformer() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?labelSelector=my-label&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&labelSelector=my-label&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -332,14 +332,14 @@ void testListLimit() throws InterruptedException { .once(); server.expect() - .withPath("/api/v1/namespaces/test/pods?limit=1&continue=x") + .withPath("/api/v1/namespaces/test/pods?continue=x&limit=1") .andReturn(HttpURLConnection.HTTP_OK, new PodListBuilder().withNewMetadata().withResourceVersion("2").endMetadata().withItems(pod2).build()) .once(); server.expect() .withPath( - "/api/v1/namespaces/test/pods?resourceVersion=2&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&resourceVersion=2&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .done() @@ -390,7 +390,7 @@ void testInformWithAlternativeKeyFunction() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .done() @@ -457,7 +457,7 @@ void testInformWithMinimalState() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .done() diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java index df73361cf0c..9e287a4bac6 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java @@ -57,7 +57,7 @@ void testInform() { // Given server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes?resourceVersion=0").andReturn(HTTP_OK, new NodeMetricsListBuilder().withMetadata(new ListMeta()).build()).once(); - server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes?timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes?allowWatchBookmarks=true&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .done() diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java index 2054dc41599..99c817200de 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java @@ -74,7 +74,7 @@ void testInform() { // Given server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods?resourceVersion=0").andReturn(HTTP_OK, new PodMetricsListBuilder().withMetadata(new ListMeta()).build()).once(); - server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods?timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods?allowWatchBookmarks=true&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .done() diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java index 7ef6f21448c..48f4a8c6840 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java @@ -628,7 +628,7 @@ void testWatch() throws InterruptedException { .build()) .once(); server.expect() - .withPath("/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&watch=true") .andUpgradeToWebSocket() .open() .waitFor(50) @@ -708,7 +708,7 @@ void testWait() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(50) diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceListTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceListTest.java index 2f137a7cf1b..598bfab3d8e 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceListTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceListTest.java @@ -206,7 +206,7 @@ void testSuccessfulWaitUntilCondition() throws InterruptedException { ResourceTest.list(server, noReady2, null); server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(ready1, "MODIFIED")) @@ -214,7 +214,7 @@ void testSuccessfulWaitUntilCondition() throws InterruptedException { .once(); server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(ready2, "MODIFIED")) @@ -256,7 +256,7 @@ void testPartialSuccessfulWaitUntilCondition() { // This pod has a non-retryable error. server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(gone, "ERROR")) @@ -265,7 +265,7 @@ void testPartialSuccessfulWaitUntilCondition() { // This pod succeeds. server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(ready2, "MODIFIED")) @@ -307,7 +307,7 @@ void testAllFailedWaitUntilCondition() { // Both pods have a non-retryable error. server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(gone, "ERROR")) @@ -315,7 +315,7 @@ void testAllFailedWaitUntilCondition() { .once(); server.expect().get().withPath( - "/api/v1/namespaces/ns1/pods?fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/ns1/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod2&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500).andEmit(new WatchEvent(gone, "ERROR")) diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java index c270e20a1dd..90a7f7796b8 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java @@ -266,7 +266,7 @@ void testWatch() throws InterruptedException { server.expect() .get() - .withPath("/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&watch=true") .andUpgradeToWebSocket() .open() .waitFor(1000) @@ -308,7 +308,7 @@ void testWaitUntilReady() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -322,7 +322,7 @@ void testWaitUntilReady() throws InterruptedException { /** * List the pod for the initial request from an informer - * + * * @param pod */ private void list(Pod pod) { @@ -361,7 +361,7 @@ void testWaitUntilExistsThenReady() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(100) @@ -421,7 +421,7 @@ void testWaitUntilCondition() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(1000) @@ -469,7 +469,7 @@ void testErrorEventDuringWaitReturnFromAPIIfMatch() throws InterruptedException server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -480,7 +480,7 @@ void testErrorEventDuringWaitReturnFromAPIIfMatch() throws InterruptedException server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -514,7 +514,7 @@ void testRetryOnErrorEventDuringWait() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -525,7 +525,7 @@ void testRetryOnErrorEventDuringWait() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -578,7 +578,7 @@ void testRetryWatchOnHttpGone() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(500) @@ -611,7 +611,7 @@ void testWaitOnConditionDeleted() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(1000) @@ -641,7 +641,7 @@ void testCreateAndWaitUntilReady() throws InterruptedException { server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .waitFor(1000) @@ -692,7 +692,7 @@ void testFromServerWaitUntilConditionAlwaysGetsResourceFromServer() throws Excep server.expect() .get() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod&resourceVersion=1&timeoutSeconds=600&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod&resourceVersion=1&timeoutSeconds=600&watch=true") .andUpgradeToWebSocket() .open() .immediately() diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/WatchTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/WatchTest.java index 927c478fa8f..68466ee5c40 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/WatchTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/WatchTest.java @@ -80,7 +80,7 @@ void testTryWithResourcesConnectsThenReceivesEvent() throws InterruptedException // Given server.expect() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -122,7 +122,7 @@ void testTryWithResourcesCantConnectShouldCloseAndThenThrowException() throws Ex final CountDownLatch closeLatch = new CountDownLatch(1); server.expect() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andReturn(410, outdatedEvent()) .once(); final Watcher watcher = new Watcher() { @@ -158,7 +158,7 @@ public void onClose() { void testWithTimeoutSecondsShouldAddQueryParam() throws InterruptedException { // Given server.expect() - .withPath("/api/v1/namespaces/test/pods?timeoutSeconds=30&allowWatchBookmarks=true&watch=true") + .withPath("/api/v1/namespaces/test/pods?allowWatchBookmarks=true&timeoutSeconds=30&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -193,7 +193,7 @@ public void onClose(WatcherException cause) { void testHttpErrorReconnect() throws InterruptedException { // Given client.getConfiguration().setWatchReconnectInterval(10); - final String path = "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true"; + final String path = "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true"; // accept watch and disconnect server.expect().withPath(path).andUpgradeToWebSocket().open().done().once(); // refuse reconnect attempts 6 times @@ -232,7 +232,7 @@ void testOnCloseEvent() throws InterruptedException { server.expect() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS) @@ -282,7 +282,7 @@ void testReconnectsWithLastResourceVersion() throws InterruptedException { .endMetadata() .build(); - final String path = "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true"; + final String path = "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true"; server.expect() .withPath(path) @@ -295,7 +295,7 @@ void testReconnectsWithLastResourceVersion() throws InterruptedException { .done() .once(); - final String reconnectPath = "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=10&allowWatchBookmarks=true&watch=true"; + final String reconnectPath = "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=10&watch=true"; server.expect() .withPath(reconnectPath) @@ -337,7 +337,7 @@ void testTryWithResourcesConnectsThenReceivesEventBookmark() throws InterruptedE // Given server.expect() .withPath( - "/api/v1/namespaces/test/pods?fieldSelector=metadata.name%3Dpod1&resourceVersion=1&allowWatchBookmarks=true&watch=true") + "/api/v1/namespaces/test/pods?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dpod1&resourceVersion=1&watch=true") .andUpgradeToWebSocket() .open() .waitFor(EVENT_WAIT_PERIOD_MS)