Skip to content

Commit fdafbac

Browse files
committed
Add 'make generate-fakes' and use it
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
1 parent 7c0c8db commit fdafbac

101 files changed

Lines changed: 32 additions & 1053 deletions

File tree

Some content is hidden

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

.github/CONTRIBUTING.md

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

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

141156
```bash
142157
go generate ./<package>/...

Makefile

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

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

240-
.PHONY: all build clean format version lint
245+
.PHONY: all build clean format generate-fakes version lint
241246
.PHONY: test units units-full install-test-deps integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
242247
.PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push
243248
.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)