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

Ignore mocks in code coverage report #1851

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions hack/update-gomock
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

set -euo pipefail

mockgen -package cloud -destination=./pkg/cloud/mock_cloud.go -source pkg/cloud/cloud_interface.go
mockgen -package cloud -destination=./pkg/cloud/mock_metadata.go -source pkg/cloud/metadata_interface.go
mockgen -package driver -destination=./pkg/driver/mock_mount.go -source pkg/driver/mount.go
mockgen -package mounter -destination=./pkg/mounter/mock_mount_windows.go -source pkg/mounter/safe_mounter_windows.go
mockgen -package cloud -destination=./pkg/cloud/mock_cloud_test.go -source pkg/cloud/cloud_interface.go
mockgen -package cloud -destination=./pkg/cloud/mock_metadata_test.go -source pkg/cloud/metadata_interface.go
mockgen -package driver -destination=./pkg/driver/mock_mount_test.go -source pkg/driver/mount.go
mockgen -package mounter -destination=./pkg/mounter/mock_mount_windows_test.go -source pkg/mounter/safe_mounter_windows.go

# Reflection-based mocking for external dependencies
mockgen -package cloud -destination=./pkg/cloud/mock_ec2.go github.com/aws/aws-sdk-go/service/ec2/ec2iface EC2API
mockgen -package driver -destination=./pkg/driver/mock_k8s_client.go -mock_names='Interface=MockKubernetesClient' k8s.io/client-go/kubernetes Interface
mockgen -package driver -destination=./pkg/driver/mock_k8s_corev1.go k8s.io/client-go/kubernetes/typed/core/v1 CoreV1Interface,NodeInterface
mockgen -package driver -destination=./pkg/driver/mock_k8s_storagev1.go k8s.io/client-go/kubernetes/typed/storage/v1 VolumeAttachmentInterface,StorageV1Interface
mockgen -package cloud -destination=./pkg/cloud/mock_ec2_test.go github.com/aws/aws-sdk-go/service/ec2/ec2iface EC2API
mockgen -package driver -destination=./pkg/driver/mock_k8s_client_test.go -mock_names='Interface=MockKubernetesClient' k8s.io/client-go/kubernetes Interface
mockgen -package driver -destination=./pkg/driver/mock_k8s_corev1_test.go k8s.io/client-go/kubernetes/typed/core/v1 CoreV1Interface,NodeInterface
mockgen -package driver -destination=./pkg/driver/mock_k8s_storagev1_test.go k8s.io/client-go/kubernetes/typed/storage/v1 VolumeAttachmentInterface,StorageV1Interface

# Fixes "Mounter Type cannot implement 'Mounter' as it has a non-exported method and is defined in a different package"
# See https://github.com/kubernetes/mount-utils/commit/a20fcfb15a701977d086330b47b7efad51eb608e for context.
sed -i '/type MockMounter struct {/a \\tmount_utils.Interface' pkg/driver/mock_mount.go
sed -i '/type MockProxyMounter struct {/a \\tmount.Interface' pkg/mounter/mock_mount_windows.go
sed -i '/type MockMounter struct {/a \\tmount_utils.Interface' pkg/driver/mock_mount_test.go
sed -i '/type MockProxyMounter struct {/a \\tmount.Interface' pkg/mounter/mock_mount_windows_test.go
274 changes: 274 additions & 0 deletions pkg/cloud/mock_cloud_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading