Friday, April 29, 2022

NotAMockException: Argument should be a mock, but is: class java.lang.Class

Argument should be a mock, but is: class java.lang.Class

org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is: class java.lang.Class

at nternal.runners.TestMethod.invoke(TestMethod.java:68)

at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:89)

at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:97)

at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87)

at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50)

at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)

at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

 Solution:

From the above description, we can know that the problem is org.mockito.internal.stubbing.answers.InvocationInfo.isVoid, stay mockito-core It's a bag . And those that include this sub package are spring-boot-starter-parentmockito-inlinepowermock-api-mockito2.

Remove  mockito-inline from  class path 
and run tests 
Reference:
https://javamana.com/2022/01/202201070338549908.html

Saturday, April 9, 2022

Kubernetes Vs Rancher

What is Difference Between Kubernetes and Rancher 

The difference between Kubernetes and Rancher is that Kubernetes is a technology for managing containers organized under a cluster of virtual or physical machines. Rancher is a technology for managing Kubernetes clusters en masse. Both of these tools are important considerations for any organization building a cloud-native, DevOps technology stack.

Kubernetes is the leader in container orchestration. It offers teams the flexibility to efficiently run containerized workloads across multiple public cloud providers and hybrid cloud environments. Kubernetes offers advanced scheduling and scaling capabilities to ensure application performance and high availability. However, its functionality focuses on managing resources within a single cluster.


Rancher, on the other hand, is a platform designed to manage multiple Kubernetes clusters. It eases Kubernetes cluster management in large environments in several ways. For example, Rancher simplifies operations such as cluster provisioning, centralized security management, and monitoring workloads using popular tools such as Prometheus. Additionally, Rancher has an extensive application catalog of Helm charts for various applications such as Kubecost, Prometheus, Grafana, and MySQL.


Kubernetes Features

The following table summarizes some of the key benefits of using Kubernetes:

1)Cloud provider-agnostic

Kubernetes based platform is easily migratable across cloud providers

2)Enables easy scaling

Containerized applications are comparatively easier to scale as compared to traditional applications hosted in virtual machines (VM)

3)Resource usage optimization

Configuration parameters make it relatively easy to control cluster density and autoscaling

4)Self-healing

In case of a node failure, pods are automatically rescheduled to other nodes

Important Rancher featuresPermalink


Rancher Features

1)Cluster provisioning and import

Rancher lets you create new clusters or add existing ones to it

2)The concept of projects

Rancher introduces the concept of projects for better grouping of namespaces

3)Extended RBAC control

User permissions can be configured per project across clusters

4)Easy workload deployment

Users can use the Rancher UI to deploy their workloads without updating a YAML file

5)Monitoring and alerting

Allows users to create notifications and push cluster logs to different backends

5)Extensive application catalog

Similar to the app store on your smart


Conclusion

The rapid adoption of Kubernetes leaves many teams with the cumbersome reality of managing too many clusters. Rancher is solving this pain point by simplifying and automating Kubernetes cluster management. With the addition of Kubecost, teams can allocate costs across clusters by aligning with the core concept of a Rancher Project, and using labels to further refine their cost visibility.


Troubleshooting Docker Image Format: Ensuring Docker v2 Instead of OCI

  Troubleshooting Docker Image Format: Ensuring Docker v2 Instead of OCI Introduction While working with Docker 27+ , I encountered an iss...