1 Reply Latest reply on Mar 31, 2017 6:14 AM by Alex Soto

    Issues with Arquillian for Kubernetes container

    Pankaj Tripathi Newbie

      Hi,

       

      I was using fabric8-arquilIian initially where I was getting exception mentioned below.

       

      org.jboss.arquillian.container.test.impl.client.deployment.ValidationException: DeploymentScenario contains a target (_DEFAULT_) not matching any defined Container in the registry.
      Please include at least 1 Deployable Container on your Classpath.
      

       

      I read about this issue on JBoss forum where it was mentioned that it might be a issue related to version of the dependencies. I changed them to include the latest ones but was still getting the same exceptions.

      After which I changed the dependency to use 'org.arquillian.cube:arquillian-cube-kubernetes-fabric8:1.0.+'. On using this dependency I am getting error mentioned below.

      Applying kubernetes configuration from: file:/Users/pankaj/workspace/xyz-platform-arquillian/src/test/resources/kubernetes.yml
      The are resources in not ready state.
      
      Deployment name: gem-db namespace:itest-d5017dde-746d-40f4-bec0-5885a1c1545d
      2017-03-07 14:46:00.094 [OkHttp https://192.168.99.100:8443/apis/extensions/v1beta1/namespaces/itest-d5017dde-746d-40f4-bec0-5885a1c1545d/deployments?fieldSelector=metadata.name%3Dgem-db&resourceVersion=148824&watch=true WebSocket Close Reply] WARN io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager - Ignoring onClose for already closed/closing websocket
      2017-03-07 14:46:00.094 [OkHttp https://192.168.99.100:8443/apis/extensions/v1beta1/namespaces/itest-d5017dde-746d-40f4-bec0-5885a1c1545d/deployments?fieldSelector=metadata.name%3Dgem-db&resourceVersion=148824&watch=true WebSocket Close Reply] WARN io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager - Ignoring onClose for already closed/closing websocket
      2017-03-07 14:46:00.094 [OkHttp https://192.168.99.100:8443/apis/extensions/v1beta1/namespaces/itest-d5017dde-746d-40f4-bec0-5885a1c1545d/deployments?fieldSelector=metadata.name%3Dgem-db&resourceVersion=148824&watch=true WebSocket Close Reply] WARN io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager - Ignoring onClose for already closed/closing websocket
      2017-03-07 14:46:00.096 [OkHttp https://192.168.99.100:8443/apis/extensions/v1beta1/namespaces/itest-d5017dde-746d-40f4-bec0-5885a1c1545d/deployments?fieldSelector=metadata.name%3Dgem-db&resourceVersion=148789&watch=true WebSocket Close Reply] WARN io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager - Ignoring onClose for already closed/closing websocket
      2017-03-07 14:46:00.097 [OkHttp https://192.168.99.100:8443/apis/extensions/v1beta1/namespaces/itest-d5017dde-746d-40f4-bec0-5885a1c1545d/deployments?fieldSelector=metadata.name%3Dgem-db&resourceVersion=148824&watch=true WebSocket Close Reply] WARN io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager - Ignoring onClose for already closed/closing websocket
      Exception in thread "OkHttp Dispatcher" java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@40b7f73 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@acc9182[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326)
        at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:573)
        at java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:735)
        at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$2.onOpen(WatchConnectionManager.java:164)
        at okhttp3.ws.WebSocketCall.createWebSocket(WebSocketCall.java:150)
        at okhttp3.ws.WebSocketCall.access$000(WebSocketCall.java:41)
        at okhttp3.ws.WebSocketCall$1.onResponse(WebSocketCall.java:97)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
      

       

      I am getting this issue even though I have a deployment running.

      I am also including my gradle file which enlists all the dependencies.

       

      Part of gradle for reference:

       

      repositories {

        mavenCentral()

        maven { url 'https://jitpack.io' }

        maven { url 'http://repository.jboss.org/nexus/content/groups/public' }

        maven { url 'http://repository.jboss.org/nexus/content/repositories/deprecated' }

        maven { url 'http://repo.jfrog.org/artifactory/repo' }

        maven { url 'http://dl.bintray.com/ethereum/maven' }

        maven { url 'http://splunk.artifactoryonline.com/splunk/ext-releases-local' }

      }

       

      dependencies {

        providedCompile "javax:javaee-api:7.0"

         compile 'org.postgresql:postgresql:9.4.+'
         compile 'org.jboss.arquillian.extension:arquillian-service-integration-spring-inject:1.1.+'

         testCompile 'junit:junit:4.12'
         testCompile 'org.slf4j:slf4j-simple:1.6.+'
         testCompile 'org.arquillian.cube:arquillian-cube-kubernetes-fabric8:1.0.+'

         testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:1.1.+'
         testCompile 'org.jboss.arquillian.protocol:arquillian-protocol-servlet:1.1.+'
         testCompile 'org.jboss.arquillian.extension:arquillian-service-integration-spring-javaconfig:1.1.+'
         testCompile 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:2.2.0'
         testCompile 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:2.2.0'
      }

       

      Test class:

       

      import static org.junit.Assert.assertNotNull;
      import io.fabric8.kubernetes.client.KubernetesClient;
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.arquillian.spring.integration.test.annotation.SpringConfiguration;
      import org.jboss.arquillian.test.api.ArquillianResource;
      import org.jboss.shrinkwrap.api.spec.JavaArchive;
      import org.junit.Ignore;
      import org.junit.Test;
      import org.junit.runner.RunWith;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.springframework.beans.factory.annotation.Autowired;
      import java.util.List;
      
      
      @RunWith(Arquillian.class)
      @SpringConfiguration
      public class ExampleTest {
          Logger logger = LoggerFactory.getLogger(ExampleTest.class);
      
          @Autowired
          GemDataService dataService;
      
          @Deployment
          public static JavaArchive createDataTestArchive(){
              return Deployments.createDataDeployment();
          }
      
          @ArquillianResource
          KubernetesClient client;
      
          @Test
          public void testClientInjection() {
              assertNotNull(client);
          }
      }