arquillian / arquillian-cube

Control (docker, kubernetes, openshift) containers in your tests with ease!
http://arquillian.org/arquillian-cube/
121 stars 98 forks source link

Environment not initialized in time exception using Arquillian Kubernetes Extension. #848

Closed hemanik closed 6 years ago

hemanik commented 7 years ago
Issue Overview

I am trying to test the Nginx Server Deployment done via Kubernetes using Arquillian Kubernetes Extension but I get the error message saying the resources are not ready.

When trying manually, it works fine.

Expected Behaviour

The service should be started and the tests should pass.

Current Behaviour

The tests fail with the error message as

Initializing Session:a588a4c7
Using Kubernetes at: https://192.168.42.166:8443/
Creating namespace: itest-a588a4c7...
To switch to the new namespace: kubectl config set-context `kubectl config current-context` --namespace=itest-a588a4c7
Applying kubernetes configuration from: file:/home/hemani/trello/shop/target/test-classes/nginx_service.yaml
Nov 15, 2017 5:56:20 PM okhttp3.internal.platform.Platform log

WARNING: A connection to https://192.168.42.166:8443/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
There are resources in not ready state:
Service name: nginxservice namespace:itest-a588a4c7
Deleting namespace: itest-a588a4c7...
Namespace: itest-a588a4c7, successfully deleted
java.lang.RuntimeException: java.lang.IllegalStateException: Environment not initialized in time.
Steps To Reproduce
  1. Clone this sample project .
  2. Execute minikube start command
  3. Run the ShopTest (arquillian kube test) from the project
lordofthejars commented 7 years ago

I am not sure if this is a good example since it uses a service but no pod, and creates a load balancer which maybe creates some kind of conflicts, I would suggest trying with https://github.com/kubernetes/examples/blob/master/guestbook/all-in-one/guestbook-all-in-one.yaml tutorial is https://github.com/kubernetes/examples/tree/master/guestbook/

hemanik commented 7 years ago

@lordofthejars, even changing the example doesn't resolve the issue. The same error is returned. The problem is in the SessionManager Class, the configuration file is read but the resources are not in the ready.

I have updated the above sample example with the new project for reference.

lordofthejars commented 7 years ago

Ok I'll take a look and see if we need help from f8 mates.

hemanik commented 6 years ago

Check issue: https://github.com/arquillian/arquillian-cube/issues/852 for resolution.