{"id":37135891,"url":"https://github.com/controller-e2e-framework/e2e-framework","last_synced_at":"2026-01-14T15:50:44.386Z","repository":{"id":176707337,"uuid":"612890271","full_name":"controller-e2e-framework/e2e-framework","owner":"controller-e2e-framework","description":"The framework doing all the heavy lifting.","archived":false,"fork":false,"pushed_at":"2023-03-28T09:01:21.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-06-21T15:48:59.591Z","etag":null,"topics":["golang","kubernetes","testing"],"latest_commit_sha":null,"homepage":null,"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/controller-e2e-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2023-03-12T09:40:01.000Z","updated_at":"2023-06-15T18:21:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"c920b3be-c1a2-4d4a-9472-573e68a3e576","html_url":"https://github.com/controller-e2e-framework/e2e-framework","commit_stats":null,"previous_names":["controller-e2e-framework/e2e-framework"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/controller-e2e-framework/e2e-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controller-e2e-framework%2Fe2e-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controller-e2e-framework%2Fe2e-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controller-e2e-framework%2Fe2e-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controller-e2e-framework%2Fe2e-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/controller-e2e-framework","download_url":"https://codeload.github.com/controller-e2e-framework/e2e-framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/controller-e2e-framework%2Fe2e-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["golang","kubernetes","testing"],"created_at":"2026-01-14T15:50:43.521Z","updated_at":"2026-01-14T15:50:44.356Z","avatar_url":"https://github.com/controller-e2e-framework.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E2E Framework\n\nThis repository contains the testing infrastructure for the controllers.\nIt contains e2e tests that run scenarios that involve 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\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://skarlso.github.io/2023/02/25/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 = envconf.RandomName(\"testing\", 32)\n\n\ttestEnv.Setup(\n\t\tenvfuncs.CreateKindCluster(kindClusterName),\n\t\tenvfuncs.CreateNamespace(namespace),\n\t\tshared.RunTiltForControllers(\"test-1-controller\", \"test-2-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. The testing 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### Running in CI\n\nFor an example of how to run the tests as a GitHub action looks at [e2e-example.yaml](e2e-example.yaml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontroller-e2e-framework%2Fe2e-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontroller-e2e-framework%2Fe2e-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontroller-e2e-framework%2Fe2e-framework/lists"}