Skip to content

Commit

Permalink
Ignore mocks in code coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSirenko committed Dec 5, 2023
1 parent 551b59a commit 337def9
Show file tree
Hide file tree
Showing 9 changed files with 38,886 additions and 10 deletions.
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

0 comments on commit 337def9

Please sign in to comment.