{"id":37020855,"url":"https://github.com/java-operator-sdk/jenvtest","last_synced_at":"2026-01-14T02:26:18.463Z","repository":{"id":142402637,"uuid":"602944642","full_name":"java-operator-sdk/jenvtest","owner":"java-operator-sdk","description":"Kubernetes Integration Test Support for Java. Moved to fabric8 client: https://github.com/fabric8io/kubernetes-client/blob/main/doc/kube-api-test.md","archived":true,"fork":false,"pushed_at":"2024-04-10T11:09:42.000Z","size":457,"stargazers_count":14,"open_issues_count":13,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T22:47:57.410Z","etag":null,"topics":["java","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/java-operator-sdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing/eclipse-google-style.xml","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-02-17T09:29:55.000Z","updated_at":"2024-04-10T11:10:20.000Z","dependencies_parsed_at":"2023-12-29T12:22:12.434Z","dependency_job_id":"fae79389-a2ac-45e9-a52d-9e69c17128ec","html_url":"https://github.com/java-operator-sdk/jenvtest","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/java-operator-sdk/jenvtest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-operator-sdk%2Fjenvtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-operator-sdk%2Fjenvtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-operator-sdk%2Fjenvtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-operator-sdk%2Fjenvtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/java-operator-sdk","download_url":"https://codeload.github.com/java-operator-sdk/jenvtest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/java-operator-sdk%2Fjenvtest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","kubernetes"],"created_at":"2026-01-14T02:26:17.912Z","updated_at":"2026-01-14T02:26:18.456Z","avatar_url":"https://github.com/java-operator-sdk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":" :warning:  **_MOVED_**  Jenvtest was renamed to kube-api-test and moved to be part of [Fabric8 Kubernetes Client](https://github.com/fabric8io/kubernetes-client/blob/main/doc/kube-api-test.md)\n\n---\n\n# jenvtest\n\njenvtest makes it easy to implement integration tests with Kubernetes API Server in Java.\nInspired by [envtest](https://book.kubebuilder.io/reference/envtest.html) in Kubebuilder (Golang).\n\nIt runs the API Server binaries directly (without nodes and other components, but with etcd). \nLinux, Windows, Mac is supported.\n\nSee also [this blog](https://csviri.medium.com/introducing-jenvtest-kubernetes-api-server-tests-made-easy-for-java-4d02a9bb26d4)\npost regarding the motivation and more.\n\n## Docs \n\nSee more documentation in [docs](https://github.com/java-operator-sdk/jenvtest/tree/main/docs) directory.\n\n## Usage\n\nInclude dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.javaoperatorsdk\u003c/groupId\u003e\n    \u003cartifactId\u003ejenvtest\u003c/artifactId\u003e\n    \u003cversion\u003e[version]\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### In Unit Tests\n\nSee sample unit\ntest [here](https://github.com/java-operator-sdk/jenvtest/blob/main/core/src/test/java/io/javaoperatorsdk/jenvtest/sample/JUnitExtensionSimpleCaseTest.java)\n\n```java\n\n@EnableKubeAPIServer\nclass JUnitExtensionSimpleCaseTest {\n\n    // Use @KubeConfig annotation to inject kube config yaml to init any client\n    @KubeConfig\n    static String kubeConfigYaml;\n\n    @Test\n    void simpleTestWithTargetVersion() {\n        var client = new KubernetesClientBuilder()\n                .withConfig(Config.fromKubeconfig(kubeConfigYaml))\n                .build();\n\n        client.resource(TestUtils.testConfigMap()).create();\n        var cm = client.resource(TestUtils.testConfigMap()).get();\n\n        Assertions.assertThat(cm).isNotNull();\n    }\n}\n```\n\n### Public API\n\nThe underlying API can be used directly.\nSee [KubeApiServer](https://github.com/java-operator-sdk/jenvtest/blob/main/core/src/main/java/io/javaoperatorsdk/jenvtest/KubeAPIServer.java)\n\nSee\nit's [usage in a test](https://github.com/java-operator-sdk/jenvtest/blob/main/core/src/test/java/io/javaoperatorsdk/jenvtest/sample/KubeApiServerTest.java).\n\n```java\nclass KubeApiServerTest {\n    \n    @Test\n    void apiServerTest() {\n        var kubeApi = new KubeAPIServer();\n        kubeApi.start();\n\n        var client =  new KubernetesClientBuilder()\n                .withConfig(Config.fromKubeconfig(kubeApi.getKubeConfigYaml()))\n                .build();\n        \n        client.resource(TestUtils.testConfigMap()).create();\n        \n        var cm = client.resource(TestUtils.testConfigMap()).get();\n        Assertions.assertThat(cm).isNotNull();\n        \n        kubeApi.stop();\n    }\n}\n```\n\n### Fabric8 Kubernetes Client Support \n\nThere is dedicated support for [Fabric8 Kubernetes Client](https://github.com/fabric8io/kubernetes-client).\n\nUsing dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.javaoperatorsdk\u003c/groupId\u003e\n    \u003cartifactId\u003ejenvtest-fabric8-client-support\u003c/artifactId\u003e\n    \u003cversion\u003e[version]\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nThe client can be directly injected to the test. See sample test [here](https://github.com/java-operator-sdk/jenvtest/blob/main/fabric8/src/test/java/io/javaoperatorsdk/jenvtest/junit/sample/JUnitFabric8ClientInjectionTest.java#L111-L111).\n\n```java\n\n@EnableKubeAPIServer\nclass JUnitFabric8ClientInjectionTest {\n\n    static KubernetesClient client;\n   \n    // emitted code     \n}  \n```\n\n### Support for Parallel Execution in Junit5\n\nParallel test execution is explicitly supported for JUnit5, in fact the project tests are running parallel. \nRunning a new instance for each test case. This speeds up the tests (in our case \u003e75%) in a way that test cases are also\nfully isolated from each other. See the [surefire plugin config](https://github.com/csviri/jenvtest/blob/6bb0510208d33cc64938b7a4518ecd0c21de8b26/pom.xml#L222-L237). \n\n### Testing Mutation and Validation Webhooks\n\nAn additional benefits os running K8S API Server this way, is that it makes easy to test\n[Conversion Hooks](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion)\nand/or\n[Dynamic Admission Controllers](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)\n\nIn general, it is a best practice to use additional standard frameworks to implement Kubernetes webhooks,\nlike [kubernetes-webooks-framework](https://github.com/java-operator-sdk/kubernetes-webooks-framework)\nwith Quarkus or Spring. However, we demonstrate how it works\nin [this test](https://github.com/java-operator-sdk/jenvtest/blob/main/samples/src/test/java/io/javaoperatorsdk/jenvtest/KubernetesMutationHookHandlingTest.java#L53-L53)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjava-operator-sdk%2Fjenvtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjava-operator-sdk%2Fjenvtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjava-operator-sdk%2Fjenvtest/lists"}