Skip to content

Create e2e test for TagsLocationTagBinding with ArtifactRegistryRepository #6221

Description

@justinsb

We need an e2e test for TagsLocationTagBinding with ArtifactRegistryRepository. You can use pkg/test/resourcefixture/testdata/basic/tags/v1alpha1/tagslocationtagbinding/tagslocationtagbinding_bucket/create.yaml as a reference (and search for other tests that create an ArtifactRegistryRepository)

I'm not sure if we have yet documented how e2e tests work, if not can you please create a docs/patterns/e2e_test.md with these details:

  • The most important thing is to create a file likepkg/test/resourcefixture/testdata/basic/tags/v1alpha1/tagslocationtagbinding/tagslocationtagbinding_bucket/create.yaml. That has the "primary" resource under test
  • If we want to test updating the resource (and it's a good idea in terms of test coverage), we create a second version of the object and write it to update.yaml
  • If there are objects that should be created before the primary object, they should be in dependencies.yaml. We can create multiple objects in dependencies.yaml, whereas in create.yaml and update.yaml we can only specify one object
  • The files that start with an underscore (e.g. _http.log) are generated files. They capture the output of running the test against real GCP (_http.log), or the final state of the object in Kubernetes (_generated_object*.golden.yaml or _final_object_old_controller.golden.yaml). Some tests support exporting the object (_generated_export*.yaml). These are golden test files so we commit them to the repo and closely check any changes to them in code review.
  • to run the test there is a helper script called hack/compare-mock (and hack/record-gcp to run against real GCP). Typically we run hack/compare-mark to record the output against our mock GCP implementation because real GCP is unavailable or slower than our mock. You can specify hack/compare-mock pkg/test/resourcefixture/testdata/basic/tags/v1alpha1/tagslocationtagbinding/tagslocationtagbinding_bucket/ to run just your test (running all the tests takes a long time, even against mockgcp)
  • the path to the test should be pkg/test/resourcefixture/testdata/basic////_/

If there are other details you want to add to docs/patterns/e2e_test.md that will be helpful for coding assistants, feel free to do so!

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions