{"id":40448916,"url":"https://github.com/open-component-model/ocm-e2e-framework","last_synced_at":"2026-02-25T15:21:36.221Z","repository":{"id":161258079,"uuid":"611298966","full_name":"open-component-model/ocm-e2e-framework","owner":"open-component-model","description":"A testing framework to e2e test ocm components.","archived":false,"fork":false,"pushed_at":"2026-01-13T08:33:26.000Z","size":3803,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-01-13T10:51:44.486Z","etag":null,"topics":["ocm","open-component-model"],"latest_commit_sha":null,"homepage":"https://ocm.software/","language":"Go","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/open-component-model.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-08T14:40:11.000Z","updated_at":"2026-01-13T08:33:23.000Z","dependencies_parsed_at":"2024-03-25T15:01:21.598Z","dependency_job_id":"f491044a-021e-4884-9a0c-c7f9e4bfadbe","html_url":"https://github.com/open-component-model/ocm-e2e-framework","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/open-component-model/ocm-e2e-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-component-model%2Focm-e2e-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-component-model%2Focm-e2e-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-component-model%2Focm-e2e-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-component-model%2Focm-e2e-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-component-model","download_url":"https://codeload.github.com/open-component-model/ocm-e2e-framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-component-model%2Focm-e2e-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ocm","open-component-model"],"created_at":"2026-01-20T17:11:12.680Z","updated_at":"2026-01-20T17:11:12.836Z","avatar_url":"https://github.com/open-component-model.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![REUSE status](https://api.reuse.software/badge/github.com/open-component-model/ocm-e2e-framework)](https://api.reuse.software/info/github.com/open-component-model/ocm-e2e-framework)\n# OCM e2e Framework\n\nThis repository contains the testing infrastructure for OCM controllers.\nIt contains e2e tests which run scenarios that involves multiple controllers\nworking together. It's built around reusable steps to minimize the amount of\ntesting code that has to be written.\n\n## Architecture\n\nThis framework is built around [Tilt](https://tilt.dev) and [e2e-framework](https://github.com/kubernetes-sigs/e2e-framework) from Kubernetes.\n\nA basic flow is outlined as such:\n\n![architecture](img/architecture.png)\n\n### Tilt\n\nWhy is Tilt involved in all of this? Tilt was added to greatly simplify setting\nup a dev environment. For a longer explanation read [this](https://github.com/open-component-model/ocm-e2e-framework/wiki/Rapid-controller-development-with-Tilt) wiki post.\n\nIt's a convenient way to set up the controllers and their dependencies such as\nRBAC, CRDs, Deployment, patches, etc.\n\nAlternatives were considered, such as building test images and pushing to local\nregistry. This was found suboptimal in cases of using CI vs. a local environment.\nThe problem is to get the manifest files. If we download them, you might be testing\nthe incorrect files locally when changing them.\n\nUsing Tilt you can be assured that you are testing the correct files and gives\na lot of flexibility in configuring the controllers.\n\n### e2e-framework\n\nThis framework provides capabilities to interact with a cluster including\ncreating and destroying them using `kind`. Each suite contains a `TestMain` which\nsets up things that the tests themselves will require. Such as:\n\n- what controllers should be started\n- port forward the registry\n- ...\n\nThe framework provides clear setup and teardown functions like this one:\n\n```go\nfunc TestMain(m *testing.M) {\n\tcfg, _ := envconf.NewFromFlags()\n\ttestEnv = env.NewWithConfig(cfg)\n\tkindClusterName = envconf.RandomName(\"component-version\", 32)\n\tnamespace = \"ocm-system\"\n\n\ttestEnv.Setup(\n\t\tenvfuncs.CreateKindCluster(kindClusterName),\n\t\tenvfuncs.CreateNamespace(namespace),\n\t\tshared.RunTiltForControllers(\"ocm-controller\", \"replication-controller\"),\n\t\tshared.ForwardRegistry(),\n\t)\n\n\ttestEnv.Finish(\n\t\tshared.ShutdownPortForward(),\n\t\tenvfuncs.DeleteNamespace(namespace),\n\t\tenvfuncs.DestroyKindCluster(kindClusterName),\n\t)\n\n\tos.Exit(testEnv.Run(m))\n}\n```\n\nFurther Setup and Teardown functions can be added under `shared/`.\n\nDetails about writing tests can be read under [Implementation](#implementations).\n\n## Running the tests\n\n### Prerequisites and project structure\n\nAny environment MUST have `tilt` and `kind` installed. To install them, run `make prepare`.\n\nAnother requirement is the controllers that are used in the test MUST be checked out next to\nthis project. ocm-e2e-framework will gradually do `cd ..` to find any controllers it needs.\n\n### Simply `go test`\n\nTo run all tests, simply run `make test`. To run an individual suite, run:\n\n`go test -v -count=1 ./test/component_version`\n\nFor a little while, it can seem like the test is hanging. This is the setup phase. You should\nsee activity once the test enters the running phase. In the meantime, you can monitor progress\nwith `kind get clusters`. `e2e-framework` sets up the kubernetes context to the kind cluster\nso, you should also be able to see pods by running `kubectl get pods -A`.\n\n### Parallel running\n\nFor now, this framework doesn't support running the suites in parallel and neither does e2e-framework.\nIt uses the kube context to set up context to the current cluster. There are some workarounds, but\ndoing that was not priority at the time of this writing. Tilt also can be told to use a different\nkube config and to run on a different port. This is future work.\n\n## Implementations\n\n### Writing tests in a declarative manner\n\nThe tests should try to follow a narrative. At the time of this writing, only two, very basic\ntests are available.\n\nTODO: Fill this out with some concrete examples once we have them.\n\n### Using shared steps\n\nThere a number of steps like, setup and assesses that can be used to construct a\ntest. If a step is not found under `shared/steps/*` consider adding it if you\nthink that it might be reused.\n\n### Waiting for objects or conditions\n\nTo wait for an object to has certain property:\n\n```go\nwait.For(conditions.New(config.Client().Resources()).ResourceScaled(deployment, func(object k8s.Object) int32 {\n    return object.(*appsv1.Deployment).Status.ReadyReplicas\n}, 2))\n```\n\nTo wait on a condition to be fulfilled:\n\n```go\n// wait for component version to be reconciled\nerr = wait.For(conditions.New(client.Resources()).ResourceMatch(cv, func(object k8s.Object) bool {\n    cvObj := object.(*v1alpha1.ComponentVersion)\n    return fconditions.IsTrue(cvObj, meta.ReadyCondition)\n}), wait.WithTimeout(time.Minute*2))\n```\n\n### Adding Setup functions\n\n### Using Context to share values between steps\n\nThe context in the `Assess` and `Setup` can be used to pass around certain values and\nobjects which the next Assess can use. For example, passing around a whole object:\n\n```go\n\tcreateDeployment := features.New(\"Create Deployment\").\n\t\tAssess(\"Create Nginx Deployment 1\", func(ctx context.Context, t *testing.T, config *envconf.Config) context.Context {\n\t\t\tdeployment := newDeployment(namespace, \"deployment-1\", 2)\n\t\t\terr := config.Client().Resources().Create(ctx, deployment)\n\t\t\tif err != nil {\n\t\t\t\tt.Error(\"failed to create test pod for deployment-1\")\n\t\t\t}\n\t\t\tctx = context.WithValue(ctx, \"DEPLOYMENT\", deployment)\n\t\t\treturn ctx\n\t\t}).\n\t\tAssess(\"Wait for Nginx Deployment 1 to be scaled up\", func(ctx context.Context, t *testing.T, config *envconf.Config) context.Context {\n\t\t\tdeployment := ctx.Value(\"DEPLOYMENT\").(*appsv1.Deployment)\n\t\t\terr := wait.For(conditions.New(config.Client().Resources()).ResourceScaled(deployment, func(object k8s.Object) int32 {\n\t\t\t\treturn object.(*appsv1.Deployment).Status.ReadyReplicas\n\t\t\t}, 2))\n\t\t\tif err != nil {\n\t\t\t\tt.Error(\"failed waiting for deployment to be scaled up\")\n\t\t\t}\n\t\t\treturn ctx\n\t\t}).Feature()\n```\n\nThen, this feature can be executed together with others.\n\n```go\n\ttestEnv.TestInParallel(t, createDeployment, checkDeployment, deleteDeployment)\n```\n\n## Using ocm-e2e-framework as a library\n\n## Release Process\n\nTo release a new version of this library, simply make sure everything is pushed that you would like to release, than\npush a new tag. The release job should take care of the rest.\n## Contributing\n\nCode contributions, feature requests, bug reports, and help requests are very welcome. Please refer to the [Contributing Guide in the Community repository](https://github.com/open-component-model/community/blob/main/CONTRIBUTING.md) for more information on how to contribute to OCM.\n\nOCM follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).\n\n## Licensing\n\nCopyright 2025 SAP SE or an SAP affiliate company and Open Component Model contributors.\nPlease see our [LICENSE](LICENSE) for copyright and license information.\nDetailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/open-component-model/replication-controller).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-component-model%2Focm-e2e-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-component-model%2Focm-e2e-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-component-model%2Focm-e2e-framework/lists"}