Search in sources :

Example 1 with HTTP_GONE

use of java.net.HttpURLConnection.HTTP_GONE in project flink by apache.

the class KubernetesPodsWatcherTest method testClosingWithTooOldResourceVersion.

@Test
public void testClosingWithTooOldResourceVersion() {
    final String errMsg = "too old resource version";
    final KubernetesPodsWatcher podsWatcher = new KubernetesPodsWatcher(new TestingCallbackHandler(e -> {
        assertThat(e, Matchers.instanceOf(KubernetesTooOldResourceVersionException.class));
        assertThat(e, FlinkMatchers.containsMessage(errMsg));
    }));
    podsWatcher.onClose(new WatcherException(errMsg, new KubernetesClientException(errMsg, HTTP_GONE, new StatusBuilder().build())));
}
Also used : KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException) StatusBuilder(io.fabric8.kubernetes.api.model.StatusBuilder) FlinkMatchers(org.apache.flink.core.testutils.FlinkMatchers) Watcher(io.fabric8.kubernetes.client.Watcher) Matchers(org.hamcrest.Matchers) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Test(org.junit.Test) FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) WatcherException(io.fabric8.kubernetes.client.WatcherException) List(java.util.List) TestLogger(org.apache.flink.util.TestLogger) Is.is(org.hamcrest.core.Is.is) HTTP_GONE(java.net.HttpURLConnection.HTTP_GONE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assert(org.junit.Assert) FlinkKubeClient(org.apache.flink.kubernetes.kubeclient.FlinkKubeClient) StatusBuilder(io.fabric8.kubernetes.api.model.StatusBuilder) WatcherException(io.fabric8.kubernetes.client.WatcherException) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException) Test(org.junit.Test)

Aggregations

StatusBuilder (io.fabric8.kubernetes.api.model.StatusBuilder)1 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)1 Watcher (io.fabric8.kubernetes.client.Watcher)1 WatcherException (io.fabric8.kubernetes.client.WatcherException)1 HTTP_GONE (java.net.HttpURLConnection.HTTP_GONE)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Consumer (java.util.function.Consumer)1 FlinkMatchers (org.apache.flink.core.testutils.FlinkMatchers)1 FlinkKubeClient (org.apache.flink.kubernetes.kubeclient.FlinkKubeClient)1 FlinkPod (org.apache.flink.kubernetes.kubeclient.FlinkPod)1 TestLogger (org.apache.flink.util.TestLogger)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Matchers (org.hamcrest.Matchers)1 Is.is (org.hamcrest.core.Is.is)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1