Skip to content

Commit 6b246ff

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

File tree

103 files changed

+32
-1911
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

+32
-1911
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
@@ -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
@@ -224,7 +229,7 @@ units-full: build units-plugin units-non-plugin
224229
version: ## Print the version number of what would be built
225230
@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
226231

227-
.PHONY: all build clean format version lint
232+
.PHONY: all build clean format generate-fakes version lint
228233
.PHONY: test units units-full install-test-deps integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
229234
.PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push
230235
.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)