Skip to content

Commit c99d814

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

101 files changed

Lines changed: 22 additions & 1043 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
@@ -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
@@ -235,7 +240,7 @@ units-full: build units-plugin units-non-plugin
235240
version: ## Print the version number of what would be built
236241
@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
237242

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