Skip to content

Commit a599788

Browse files
committed
Add 'make generate-fakes' and use it
Signed-off-by: Marc Khouzam <[email protected]>
1 parent 83f6521 commit a599788

File tree

103 files changed

+22
-1901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+22
-1901
lines changed

.github/CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,22 @@ below.
139139

140140
The CLI uses [`counterfeiter`](https://github.com/maxbrunsfeld/counterfeiter) to
141141
generate fakes from interfaces for the unit tests. If any changes are made to an
142-
interface, the fakes be should regenerated using counterfeiter:
142+
interface, the fakes be should regenerated using counterfeiter.
143+
144+
### Regenerating all non-legacy fakes
145+
146+
To regenerate fakes for all non-legacy packages (recommended for most cases):
147+
148+
```bash
149+
make generate-fakes
150+
```
151+
152+
This will safely regenerate fakes in the `util`, `plugin`, `command`, `api`, and
153+
`actor` packages without touching the legacy `cf/` codebase.
154+
155+
### Regenerating fakes for a specific package
156+
157+
If you only need to regenerate fakes for a specific package:
143158

144159
```bash
145160
go generate ./<package>/...

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ fly-windows-units:
6767
format: ## Run go fmt
6868
go fmt ./...
6969

70+
generate-fakes: ## Regenerate counterfeiter fakes for non-legacy packages
71+
@echo "Generating fakes for non-legacy packages..."
72+
go generate ./util/... ./plugin/... ./command/... ./api/... ./actor/...
73+
@echo "Fakes generated successfully!"
74+
7075
install-test-deps: ## Install "global" dependencies needed to run tests
7176
# Running `go install <pkg>` without a version specifier will use version specified in go.mod
7277
# See https://go.dev/ref/mod#go-install
@@ -222,7 +227,7 @@ units-full: build units-plugin units-non-plugin
222227
version: ## Print the version number of what would be built
223228
@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
224229

225-
.PHONY: all build clean format version lint
230+
.PHONY: all build clean format generate-fakes version lint
226231
.PHONY: test units units-full install-test-deps integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
227232
.PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push
228233
.PHONY: help

actor/cfnetworkingaction/cfnetworkingactionfakes/fake_cloud_controller_client.go

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/cfnetworkingaction/cfnetworkingactionfakes/fake_networking_client.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/pluginaction/pluginactionfakes/fake_command_list.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/pluginaction/pluginactionfakes/fake_config.go

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/pluginaction/pluginactionfakes/fake_plugin_client.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/pluginaction/pluginactionfakes/fake_plugin_metadata.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/pluginaction/pluginactionfakes/fake_plugin_uninstaller.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actor/sharedaction/sharedactionfakes/fake_config.go

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)