Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Fix: issues when running tests #247

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix: issues when running tests #247

wants to merge 2 commits into from

Conversation

ksfi
Copy link

@ksfi ksfi commented Nov 21, 2023

On macOS 12.7.1 Macbook Pro Intel
Command: go get github.com/golang/mock/mockgen && make test

Had a few issues when running tests:

First with the github.com/golang/mock/gomock package, changed it to go.uber.org/mock/gomock which is the now maintained repo since June 2023.

trace/backend_collector_test.go:55:44: cannot use ctrl (variable of type *"github.com/golang/mock/gomock".Controller) as *"go.uber.org/mock/gomock".Controller value in argument to mockrest.NewMockLearnClient
trace/backend_collector_test.go:193:44: cannot use ctrl (variable of type *"github.com/golang/mock/gomock".Controller) as *"go.uber.org/mock/gomock".Controller value in argument to mockrest.NewMockLearnClient
trace/backend_collector_test.go:246:44: cannot use ctrl (variable of type *"github.com/golang/mock/gomock".Controller) as *"go.uber.org/mock/gomock".Controller value in argument to mockrest.NewMockLearnClient
?   	github.com/akitasoftware/akita-cli/upload	[no test files]
?   	github.com/akitasoftware/akita-cli/usage	[no test files]
ok  	github.com/akitasoftware/akita-cli/pcap	0.324s
FAIL	github.com/akitasoftware/akita-cli/trace [build failed]
?   	github.com/akitasoftware/akita-cli/util	[no test files]
?   	github.com/akitasoftware/akita-cli/version	[no test files]
ok  	github.com/akitasoftware/akita-cli/useragent	0.211s
FAIL
make: *** [test] Error 1

Then with TestObfuscate

--- FAIL: TestObfuscate (0.00s)
    report_buffer.go:92: wrong number of arguments in Do func for *mock.MockLearnClient.AsyncReportsUpload The function signature must match the mocked method, a variadic function cannot be used.
--- FAIL: TestTiming (0.00s)
    report_buffer.go:92: wrong number of arguments in Do func for *mock.MockLearnClient.AsyncReportsUpload The function signature must match the mocked method, a variadic function cannot be used.
FAIL
FAIL	github.com/akitasoftware/akita-cli/trace	0.446s
ok  	github.com/akitasoftware/akita-cli/useragent	(cached)
FAIL
make: *** [test] Error 1

Should be OK now

mkdir -p ./rest/mock
mockgen -source ./rest/interface.go -destination ./rest/mock/interface.mock.go -package mock
go test ./...
?   	github.com/akitasoftware/akita-cli	[no test files]
?   	github.com/akitasoftware/akita-cli/apidiff	[no test files]
?   	github.com/akitasoftware/akita-cli/apispec	[no test files]
?   	github.com/akitasoftware/akita-cli/architecture	[no test files]
?   	github.com/akitasoftware/akita-cli/cfg	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/akiflag	[no test files]
?   	github.com/akitasoftware/akita-cli/ci	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/apidiff	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/apispec	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/ascii	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/ci_guard	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/cmderr	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/daemon	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/apidump	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/ec2	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/get	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/ecs	[no test files]
ok  	github.com/akitasoftware/akita-cli/apidump	(cached)
ok  	github.com/akitasoftware/akita-cli/cmd/internal/kube	(cached)
?   	github.com/akitasoftware/akita-cli/cmd/internal/learn	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/legacy	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/login	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/nginx	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/setversion	[no test files]
?   	github.com/akitasoftware/akita-cli/cmd/internal/pluginloader	[no test files]
ok  	github.com/akitasoftware/akita-cli/cmd/internal/kube/injector	(cached)
?   	github.com/akitasoftware/akita-cli/cmd/internal/upload	[no test files]
?   	github.com/akitasoftware/akita-cli/daemon	[no test files]
?   	github.com/akitasoftware/akita-cli/daemon/internal/cloud_client	[no test files]
?   	github.com/akitasoftware/akita-cli/deployment	[no test files]
?   	github.com/akitasoftware/akita-cli/env	[no test files]
?   	github.com/akitasoftware/akita-cli/har_loader	[no test files]
?   	github.com/akitasoftware/akita-cli/integrations/nginx	[no test files]
?   	github.com/akitasoftware/akita-cli/location	[no test files]
ok  	github.com/akitasoftware/akita-cli/learn	(cached)
?   	github.com/akitasoftware/akita-cli/plugin	[no test files]
?   	github.com/akitasoftware/akita-cli/plugin/akita	[no test files]
?   	github.com/akitasoftware/akita-cli/printer	[no test files]
?   	github.com/akitasoftware/akita-cli/rest	[no test files]
?   	github.com/akitasoftware/akita-cli/rest/mock	[no test files]
?   	github.com/akitasoftware/akita-cli/setversion	[no test files]
?   	github.com/akitasoftware/akita-cli/tcp_conn_tracker	[no test files]
?   	github.com/akitasoftware/akita-cli/telemetry	[no test files]
?   	github.com/akitasoftware/akita-cli/tls_conn_tracker	[no test files]
ok  	github.com/akitasoftware/akita-cli/pcap	(cached)
?   	github.com/akitasoftware/akita-cli/upload	[no test files]
?   	github.com/akitasoftware/akita-cli/usage	[no test files]
?   	github.com/akitasoftware/akita-cli/util	[no test files]
?   	github.com/akitasoftware/akita-cli/version	[no test files]
ok  	github.com/akitasoftware/akita-cli/trace	(cached)
ok  	github.com/akitasoftware/akita-cli/useragent	(cached)

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

Successfully merging this pull request may close these issues.

None yet

1 participant