Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile fix, and tests refactoring #399

Merged
merged 1 commit into from
Sep 16, 2021
Merged

Conversation

grongor
Copy link
Contributor

@grongor grongor commented Aug 18, 2021

I'm not sure if mocks like mocks/cmd/stackTracer.go were being generated for a reason, if so then I can add them back. However, they were not used anywhere so I went ahead and deleted them.

@LandonTClipp
Copy link
Collaborator

There's no reason not to keep them, it's just auto-generated stuff. Running mockery on the repo again would re-create them.

If you re-submit with the mocks added back I can approve.

@grongor
Copy link
Contributor Author

grongor commented Sep 13, 2021

@LandonTClipp thanks for your time! The thing with "running mockery again" is that it was run incorrectly before. You had to do it manually somehow (not versioned in Makefile) and it didn't work out of the box. When I run the make mocks again, they are not added anymore, and they are not needed for the tests. Please see this console output of what I just tried:

╭─grongor@grongor-nb ~/projects/mockery  ‹master› 
╰─➤  git status
On branch master
Your branch is up to date with 'upstream/master'.

nothing to commit, working tree clean
╭─grongor@grongor-nb ~/projects/mockery  ‹master› 
╰─➤  make fixture
mockery --print --dir pkg/fixtures --name RequesterVariadic > pkg/fixtures/mocks/requester_variadic.go
Using config file: /home/grongor/projects/mockery/.mockery.yaml
13 Sep 21 09:39 CEST INF Starting mockery dry-run=false version=v0.0.0-dev
13 Sep 21 09:39 CEST FTL Specify --name or --all, but not both dry-run=false version=v0.0.0-dev
make: *** [Makefile:15: fixture] Error 1
╭─grongor@grongor-nb ~/projects/mockery  ‹master*› 
╰─➤  make test                                                                                                                                           2 ↵
go test ./...
pkg/fixtures/mocks/requester_variadic.go:1:1: expected 'package', found 'EOF'
make: *** [Makefile:12: test] Error 1
╭─grongor@grongor-nb ~/projects/mockery  ‹master*› 
╰─➤  git status                                                                                                                                          2 ↵
On branch master
Your branch is up to date with 'upstream/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   pkg/fixtures/mocks/requester_variadic.go

no changes added to commit (use "git add" and/or "git commit -a")
╭─grongor@grongor-nb ~/projects/mockery  ‹master*› 
╰─➤  git reset --hard
HEAD is now at ead8b66 Merge pull request #404 from vektra/testing
╭─grongor@grongor-nb ~/projects/mockery  ‹master› 
╰─➤  git checkout refactoring 
Switched to branch 'refactoring'
╭─grongor@grongor-nb ~/projects/mockery  ‹refactoring› 
╰─➤  make clean
rm -rf mocks
╭─grongor@grongor-nb ~/projects/mockery  ‹refactoring*› 
╰─➤  make test 
go run . --dir pkg/fixtures --output mocks/pkg/fixtures
Using config file: /home/grongor/projects/mockery/.mockery.yaml
13 Sep 21 09:40 CEST INF Starting mockery dry-run=false version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Walking dry-run=false version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=A qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=AsyncProducer qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Blank qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=ConsulLock qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Example qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Foo qualified-name=github.com/vektra/mockery/v2/pkg/fixtures/example_project/foo version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Fooer qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=FuncArgsCollision qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=HasConflictingNestedImports qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=IfaceWithBuildTagInComment qualified-name=github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=IfaceWithBuildTagInFilename qualified-name=github.com/vektra/mockery/v2/pkg/fixtures/buildtag/filename version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=ImportsSameAsPackage qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=KeyManager qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=MapFunc qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=MapToInterface qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=MyReader qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Requester qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Requester2 qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Requester3 qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Requester4 qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterArgSameAsImport qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterArgSameAsNamedImport qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterArgSameAsPkg qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterArray qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterElided qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterIface qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterNS qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterPtr qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterReturnElided qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterSlice qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterVariadic qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Root qualified-name=github.com/vektra/mockery/v2/pkg/fixtures/example_project version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=SendFunc qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=Sibling qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=UsesOtherPkgIface qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=requester_unexported qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
go run . --all=false --print --dir pkg/fixtures --name RequesterVariadic --structname RequesterVariadicOneArgument --unroll-variadic=False > mocks/pkg/fixtures/RequesterVariadicOneArgument.go
Using config file: /home/grongor/projects/mockery/.mockery.yaml
13 Sep 21 09:40 CEST INF Starting mockery dry-run=false version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Walking dry-run=false version=v0.0.0-dev
13 Sep 21 09:40 CEST INF Generating mock dry-run=false interface=RequesterVariadic qualified-name=github.com/vektra/mockery/v2/pkg/fixtures version=v0.0.0-dev
go test ./...
?   	github.com/vektra/mockery/v2	[no test files]
ok  	github.com/vektra/mockery/v2/cmd	(cached) [no tests to run]
?   	github.com/vektra/mockery/v2/mocks/pkg/fixtures	[no test files]
?   	github.com/vektra/mockery/v2/mocks/pkg/fixtures/buildtag/comment	[no test files]
?   	github.com/vektra/mockery/v2/mocks/pkg/fixtures/buildtag/filename	[no test files]
?   	github.com/vektra/mockery/v2/mocks/pkg/fixtures/example_project	[no test files]
?   	github.com/vektra/mockery/v2/mocks/pkg/fixtures/example_project/foo	[no test files]
ok  	github.com/vektra/mockery/v2/pkg	8.554s
?   	github.com/vektra/mockery/v2/pkg/config	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/buildtag/filename	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/example_project	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/example_project/foo	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/http	[no test files]
?   	github.com/vektra/mockery/v2/pkg/fixtures/test	[no test files]
?   	github.com/vektra/mockery/v2/pkg/logging	[no test files]
╭─grongor@grongor-nb ~/projects/mockery  ‹refactoring› 
╰─➤  git status
On branch refactoring
nothing to commit, working tree clean

If you still think I should add them back, then no problem, I'll modify the Makefile to include them, but I think it's just dead code and in the past it was included by an accident (by running mockery with wrong options/arguments).

@LandonTClipp
Copy link
Collaborator

Looks good to me, thanks for the cleanup!

@LandonTClipp LandonTClipp merged commit 4fca66e into vektra:master Sep 16, 2021
@grongor
Copy link
Contributor Author

grongor commented Sep 16, 2021

Happy to help :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants