Skip to content

The table tests should make use of resources.MakeFoo as much as possible. #1517

@mattmoor

Description

@mattmoor

This is a chicken and egg problem, since the resources package didn't exist when most of this was written (but it did for Route, which I avoided because of the v1alpha3 work). As a result, when I wrote the Route controller's table tests, I was able to take advantage of the resources package to synthesize the assorted child resources based on the input revision.

I think the pattern I like the most is:

  1. Write test helper methods for synthesizing the core resource in the appropriate state (e.g. rev("foo", "bar", "Active", "image") in revision/table_test.go)
  2. Populate the Listers (input state), WantXYZ entries (output state) via resources.MakeFoo(...) where the same helper method is used to supply the core resource again.
  3. For both the core resource and these child resources, write helper methods to mutate them into the states needed for different test cases (e.g. addConfigLabel, mutateService, ...)

I think this gets us the tersest expression of the table test that conveys what we want.

Metadata

Metadata

Assignees

Labels

area/APIAPI objects and controllerskind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions