How do I create a unittest for a servicelayer which uses the client? #5050
-
How do I mock the client in a proper way so I can unittest my dependent services? For example
If I call I tried several things with Mockito. Maybe someone can help me a bit? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@MartijnStraatman : Have you tried Fabric8 Kubernetes Mock Server? You can see an example of mocking custom resource call here. There is also an option of setting up test etcd/kubernetes apiserver environment using jenvtest . See blogpost |
Beta Was this translation helpful? Give feedback.
-
I did. The CRD's I am using is not something I have created myself. I am just wondering how I can test my own service logic against the kubernetes responses. So how can I intregrate the Fabric8 Kubernetes Mock Server in my unittest as the service layer will use that Mock Server? |
Beta Was this translation helpful? Give feedback.
-
Thx, worked! |
Beta Was this translation helpful? Give feedback.
You can read my blogpost to get some idea about this How to write tests with Fabric8 Kubernetes Client