Repository: kubernetes-sigs/aws-ebs-csi-driver
Pull request #1078 (2021-10-05 00:15:02)

Move mocks to parent package to avoid import cycle
**Is this a bug fix or adding new feature?**

**What is this PR about? / Why do we need it?**
I would like to move the cloud mocks to pkg/cloud from pkg/driver because they belong in pkg/cloud but that results in import cycle because mock_cloud.go depends on pkg/cloud e.g. for cloud.DiskOptions. If I recall correctly they are in pkg/driver as a hack to avoid this import cycle.
```
# github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud
package github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud (test)
	imports github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/mocks
	imports github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud: import cycle not allowed in test
```
It seems simplest to just get rid of the mocks package and let mocks live in same package as what they are mocking.

(This is part of some effort to reorganize pkg/cloud to be easily copyable/consumable from EFS repo, see also "Refactor pkg/cloud/metadata.go into pkg/cloud/metadata_*.go files" https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1074)
**What testing is done?** 



Patch:
diff --git a/hack/update-gomock b/hack/update-gomock
index 63c7e413..6d6e30ad 100755
--- a/hack/update-gomock
+++ b/hack/update-gomock
@@ -16,7 +16,7 @@
 
 set -euo pipefail
 
-./bin/mockgen -package mocks -destination=./pkg/cloud/mocks/mock_ec2.go -source pkg/cloud/ec2_interface.go
-./bin/mockgen -package mocks -destination=./pkg/driver/mocks/mock_cloud.go -source pkg/cloud/cloud_interface.go
-./bin/mockgen -package mocks -destination=./pkg/driver/mocks/mock_metadata.go -source pkg/cloud/metadata_interface.go
-./bin/mockgen -package mocks -destination=./pkg/driver/mocks/mock_mount.go -source pkg/driver/mount.go
+./bin/mockgen -package cloud -destination=./pkg/cloud/mock_ec2.go -source pkg/cloud/ec2_interface.go
+./bin/mockgen -package cloud -destination=./pkg/cloud/mock_cloud.go -source pkg/cloud/cloud_interface.go
+./bin/mockgen -package cloud -destination=./pkg/cloud/mock_metadata.go -source pkg/cloud/metadata_interface.go
+./bin/mockgen -package driver -destination=./pkg/driver/mock_mount.go -source pkg/driver/mount.go
diff --git a/pkg/cloud/ec2_interface.go b/pkg/cloud/ec2_interface.go
index b85d6670..5da6b698 100644
--- a/pkg/cloud/ec2_interface.go
+++ b/pkg/cloud/ec2_interface.go
@@ -18,7 +18,6 @@ package cloud
 
 import (
 	"github.com/aws/aws-sdk-go/aws"
-	"github.com/aws/aws-sdk-go/aws/ec2metadata"
 	"github.com/aws/aws-sdk-go/aws/request"
 	"github.com/aws/aws-sdk-go/service/ec2"
 )
@@ -39,10 +38,3 @@ type EC2 interface {
 	DescribeVolumesModificationsWithContext(ctx aws.Context, input *ec2.DescribeVolumesModificationsInput, opts ...request.Option) (*ec2.DescribeVolumesModificationsOutput, error)
 	DescribeAvailabilityZonesWithContext(ctx aws.Context, input *ec2.DescribeAvailabilityZonesInput, opts ...request.Option) (*ec2.DescribeAvailabilityZonesOutput, error)
 }
-
-type EC2Metadata interface {
-	Available() bool
-	// ec2 instance metadata endpoints: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
-	GetMetadata(string) (string, error)
-	GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)
-}
diff --git a/pkg/cloud/metadata_interface.go b/pkg/cloud/metadata_interface.go
index e4b7c1e0..005a1ad7 100644
--- a/pkg/cloud/metadata_interface.go
+++ b/pkg/cloud/metadata_interface.go
@@ -1,6 +1,9 @@
 package cloud
 
-import "github.com/aws/aws-sdk-go/aws/arn"
+import (
+	"github.com/aws/aws-sdk-go/aws/arn"
+	"github.com/aws/aws-sdk-go/aws/ec2metadata"
+)
 
 // MetadataService represents AWS metadata service.
 type MetadataService interface {
@@ -10,3 +13,10 @@ type MetadataService interface {
 	GetAvailabilityZone() string
 	GetOutpostArn() arn.ARN
 }
+
+type EC2Metadata interface {
+	Available() bool
+	// ec2 instance metadata endpoints: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+	GetMetadata(string) (string, error)
+	GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)
+}
diff --git a/pkg/driver/mocks/mock_cloud.go b/pkg/cloud/mock_cloud.go
similarity index 92%
rename from pkg/driver/mocks/mock_cloud.go
rename to pkg/cloud/mock_cloud.go
index 7d2bacc3..e0d6ac26 100644
--- a/pkg/driver/mocks/mock_cloud.go
+++ b/pkg/cloud/mock_cloud.go
@@ -1,8 +1,8 @@
 // Code generated by MockGen. DO NOT EDIT.
 // Source: pkg/cloud/cloud_interface.go
 
-// Package mocks is a generated GoMock package.
-package mocks
+// Package cloud is a generated GoMock package.
+package cloud
 
 import (
 	context "context"
@@ -10,7 +10,6 @@ import (
 
 	ec2 "github.com/aws/aws-sdk-go/service/ec2"
 	gomock "github.com/golang/mock/gomock"
-	cloud "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
 )
 
 // MockCloud is a mock of Cloud interface.
@@ -52,10 +51,10 @@ func (mr *MockCloudMockRecorder) AttachDisk(ctx, volumeID, nodeID interface{}) *
 }
 
 // CreateDisk mocks base method.
-func (m *MockCloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *cloud.DiskOptions) (*cloud.Disk, error) {
+func (m *MockCloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *DiskOptions) (*Disk, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "CreateDisk", ctx, volumeName, diskOptions)
-	ret0, _ := ret[0].(*cloud.Disk)
+	ret0, _ := ret[0].(*Disk)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -67,10 +66,10 @@ func (mr *MockCloudMockRecorder) CreateDisk(ctx, volumeName, diskOptions interfa
 }
 
 // CreateSnapshot mocks base method.
-func (m *MockCloud) CreateSnapshot(ctx context.Context, volumeID string, snapshotOptions *cloud.SnapshotOptions) (*cloud.Snapshot, error) {
+func (m *MockCloud) CreateSnapshot(ctx context.Context, volumeID string, snapshotOptions *SnapshotOptions) (*Snapshot, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "CreateSnapshot", ctx, volumeID, snapshotOptions)
-	ret0, _ := ret[0].(*cloud.Snapshot)
+	ret0, _ := ret[0].(*Snapshot)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -126,10 +125,10 @@ func (mr *MockCloudMockRecorder) DetachDisk(ctx, volumeID, nodeID interface{}) *
 }
 
 // GetDiskByID mocks base method.
-func (m *MockCloud) GetDiskByID(ctx context.Context, volumeID string) (*cloud.Disk, error) {
+func (m *MockCloud) GetDiskByID(ctx context.Context, volumeID string) (*Disk, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "GetDiskByID", ctx, volumeID)
-	ret0, _ := ret[0].(*cloud.Disk)
+	ret0, _ := ret[0].(*Disk)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -141,10 +140,10 @@ func (mr *MockCloudMockRecorder) GetDiskByID(ctx, volumeID interface{}) *gomock.
 }
 
 // GetDiskByName mocks base method.
-func (m *MockCloud) GetDiskByName(ctx context.Context, name string, capacityBytes int64) (*cloud.Disk, error) {
+func (m *MockCloud) GetDiskByName(ctx context.Context, name string, capacityBytes int64) (*Disk, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "GetDiskByName", ctx, name, capacityBytes)
-	ret0, _ := ret[0].(*cloud.Disk)
+	ret0, _ := ret[0].(*Disk)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -156,10 +155,10 @@ func (mr *MockCloudMockRecorder) GetDiskByName(ctx, name, capacityBytes interfac
 }
 
 // GetSnapshotByID mocks base method.
-func (m *MockCloud) GetSnapshotByID(ctx context.Context, snapshotID string) (*cloud.Snapshot, error) {
+func (m *MockCloud) GetSnapshotByID(ctx context.Context, snapshotID string) (*Snapshot, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "GetSnapshotByID", ctx, snapshotID)
-	ret0, _ := ret[0].(*cloud.Snapshot)
+	ret0, _ := ret[0].(*Snapshot)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -171,10 +170,10 @@ func (mr *MockCloudMockRecorder) GetSnapshotByID(ctx, snapshotID interface{}) *g
 }
 
 // GetSnapshotByName mocks base method.
-func (m *MockCloud) GetSnapshotByName(ctx context.Context, name string) (*cloud.Snapshot, error) {
+func (m *MockCloud) GetSnapshotByName(ctx context.Context, name string) (*Snapshot, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "GetSnapshotByName", ctx, name)
-	ret0, _ := ret[0].(*cloud.Snapshot)
+	ret0, _ := ret[0].(*Snapshot)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
@@ -200,10 +199,10 @@ func (mr *MockCloudMockRecorder) IsExistInstance(ctx, nodeID interface{}) *gomoc
 }
 
 // ListSnapshots mocks base method.
-func (m *MockCloud) ListSnapshots(ctx context.Context, volumeID string, maxResults int64, nextToken string) (*cloud.ListSnapshotsResponse, error) {
+func (m *MockCloud) ListSnapshots(ctx context.Context, volumeID string, maxResults int64, nextToken string) (*ListSnapshotsResponse, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "ListSnapshots", ctx, volumeID, maxResults, nextToken)
-	ret0, _ := ret[0].(*cloud.ListSnapshotsResponse)
+	ret0, _ := ret[0].(*ListSnapshotsResponse)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }
diff --git a/pkg/cloud/mocks/mock_ec2.go b/pkg/cloud/mock_ec2.go
similarity index 82%
rename from pkg/cloud/mocks/mock_ec2.go
rename to pkg/cloud/mock_ec2.go
index fae1bd29..0fbb9e48 100644
--- a/pkg/cloud/mocks/mock_ec2.go
+++ b/pkg/cloud/mock_ec2.go
@@ -1,14 +1,13 @@
 // Code generated by MockGen. DO NOT EDIT.
 // Source: pkg/cloud/ec2_interface.go
 
-// Package mocks is a generated GoMock package.
-package mocks
+// Package cloud is a generated GoMock package.
+package cloud
 
 import (
 	reflect "reflect"
 
 	aws "github.com/aws/aws-sdk-go/aws"
-	ec2metadata "github.com/aws/aws-sdk-go/aws/ec2metadata"
 	request "github.com/aws/aws-sdk-go/aws/request"
 	ec2 "github.com/aws/aws-sdk-go/service/ec2"
 	gomock "github.com/golang/mock/gomock"
@@ -276,70 +275,3 @@ func (mr *MockEC2MockRecorder) ModifyVolumeWithContext(ctx, input interface{}, o
 	varargs := append([]interface{}{ctx, input}, opts...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ModifyVolumeWithContext", reflect.TypeOf((*MockEC2)(nil).ModifyVolumeWithContext), varargs...)
 }
-
-// MockEC2Metadata is a mock of EC2Metadata interface.
-type MockEC2Metadata struct {
-	ctrl     *gomock.Controller
-	recorder *MockEC2MetadataMockRecorder
-}
-
-// MockEC2MetadataMockRecorder is the mock recorder for MockEC2Metadata.
-type MockEC2MetadataMockRecorder struct {
-	mock *MockEC2Metadata
-}
-
-// NewMockEC2Metadata creates a new mock instance.
-func NewMockEC2Metadata(ctrl *gomock.Controller) *MockEC2Metadata {
-	mock := &MockEC2Metadata{ctrl: ctrl}
-	mock.recorder = &MockEC2MetadataMockRecorder{mock}
-	return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use.
-func (m *MockEC2Metadata) EXPECT() *MockEC2MetadataMockRecorder {
-	return m.recorder
-}
-
-// Available mocks base method.
-func (m *MockEC2Metadata) Available() bool {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Available")
-	ret0, _ := ret[0].(bool)
-	return ret0
-}
-
-// Available indicates an expected call of Available.
-func (mr *MockEC2MetadataMockRecorder) Available() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Available", reflect.TypeOf((*MockEC2Metadata)(nil).Available))
-}
-
-// GetInstanceIdentityDocument mocks base method.
-func (m *MockEC2Metadata) GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "GetInstanceIdentityDocument")
-	ret0, _ := ret[0].(ec2metadata.EC2InstanceIdentityDocument)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// GetInstanceIdentityDocument indicates an expected call of GetInstanceIdentityDocument.
-func (mr *MockEC2MetadataMockRecorder) GetInstanceIdentityDocument() *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceIdentityDocument", reflect.TypeOf((*MockEC2Metadata)(nil).GetInstanceIdentityDocument))
-}
-
-// GetMetadata mocks base method.
-func (m *MockEC2Metadata) GetMetadata(arg0 string) (string, error) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "GetMetadata", arg0)
-	ret0, _ := ret[0].(string)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// GetMetadata indicates an expected call of GetMetadata.
-func (mr *MockEC2MetadataMockRecorder) GetMetadata(arg0 interface{}) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetadata", reflect.TypeOf((*MockEC2Metadata)(nil).GetMetadata), arg0)
-}
diff --git a/pkg/driver/mocks/mock_metadata.go b/pkg/cloud/mock_metadata.go
similarity index 57%
rename from pkg/driver/mocks/mock_metadata.go
rename to pkg/cloud/mock_metadata.go
index eda6d967..be2d1b21 100644
--- a/pkg/driver/mocks/mock_metadata.go
+++ b/pkg/cloud/mock_metadata.go
@@ -1,13 +1,14 @@
 // Code generated by MockGen. DO NOT EDIT.
 // Source: pkg/cloud/metadata_interface.go
 
-// Package mocks is a generated GoMock package.
-package mocks
+// Package cloud is a generated GoMock package.
+package cloud
 
 import (
 	reflect "reflect"
 
 	arn "github.com/aws/aws-sdk-go/aws/arn"
+	ec2metadata "github.com/aws/aws-sdk-go/aws/ec2metadata"
 	gomock "github.com/golang/mock/gomock"
 )
 
@@ -103,3 +104,70 @@ func (mr *MockMetadataServiceMockRecorder) GetRegion() *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRegion", reflect.TypeOf((*MockMetadataService)(nil).GetRegion))
 }
+
+// MockEC2Metadata is a mock of EC2Metadata interface.
+type MockEC2Metadata struct {
+	ctrl     *gomock.Controller
+	recorder *MockEC2MetadataMockRecorder
+}
+
+// MockEC2MetadataMockRecorder is the mock recorder for MockEC2Metadata.
+type MockEC2MetadataMockRecorder struct {
+	mock *MockEC2Metadata
+}
+
+// NewMockEC2Metadata creates a new mock instance.
+func NewMockEC2Metadata(ctrl *gomock.Controller) *MockEC2Metadata {
+	mock := &MockEC2Metadata{ctrl: ctrl}
+	mock.recorder = &MockEC2MetadataMockRecorder{mock}
+	return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockEC2Metadata) EXPECT() *MockEC2MetadataMockRecorder {
+	return m.recorder
+}
+
+// Available mocks base method.
+func (m *MockEC2Metadata) Available() bool {
+	m.ctrl.T.Helper()
+	ret := m.ctrl.Call(m, "Available")
+	ret0, _ := ret[0].(bool)
+	return ret0
+}
+
+// Available indicates an expected call of Available.
+func (mr *MockEC2MetadataMockRecorder) Available() *gomock.Call {
+	mr.mock.ctrl.T.Helper()
+	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Available", reflect.TypeOf((*MockEC2Metadata)(nil).Available))
+}
+
+// GetInstanceIdentityDocument mocks base method.
+func (m *MockEC2Metadata) GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error) {
+	m.ctrl.T.Helper()
+	ret := m.ctrl.Call(m, "GetInstanceIdentityDocument")
+	ret0, _ := ret[0].(ec2metadata.EC2InstanceIdentityDocument)
+	ret1, _ := ret[1].(error)
+	return ret0, ret1
+}
+
+// GetInstanceIdentityDocument indicates an expected call of GetInstanceIdentityDocument.
+func (mr *MockEC2MetadataMockRecorder) GetInstanceIdentityDocument() *gomock.Call {
+	mr.mock.ctrl.T.Helper()
+	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceIdentityDocument", reflect.TypeOf((*MockEC2Metadata)(nil).GetInstanceIdentityDocument))
+}
+
+// GetMetadata mocks base method.
+func (m *MockEC2Metadata) GetMetadata(arg0 string) (string, error) {
+	m.ctrl.T.Helper()
+	ret := m.ctrl.Call(m, "GetMetadata", arg0)
+	ret0, _ := ret[0].(string)
+	ret1, _ := ret[1].(error)
+	return ret0, ret1
+}
+
+// GetMetadata indicates an expected call of GetMetadata.
+func (mr *MockEC2MetadataMockRecorder) GetMetadata(arg0 interface{}) *gomock.Call {
+	mr.mock.ctrl.T.Helper()
+	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetadata", reflect.TypeOf((*MockEC2Metadata)(nil).GetMetadata), arg0)
+}
diff --git a/pkg/driver/mocks/mock_mount.go b/pkg/driver/mock_mount.go
similarity index 99%
rename from pkg/driver/mocks/mock_mount.go
rename to pkg/driver/mock_mount.go
index e99f5768..61e01dff 100644
--- a/pkg/driver/mocks/mock_mount.go
+++ b/pkg/driver/mock_mount.go
@@ -1,8 +1,8 @@
 // Code generated by MockGen. DO NOT EDIT.
 // Source: pkg/driver/mount.go
 
-// Package mocks is a generated GoMock package.
-package mocks
+// Package driver is a generated GoMock package.
+package driver
 
 import (
 	reflect "reflect"


Test patch:
diff --git a/pkg/cloud/cloud_test.go b/pkg/cloud/cloud_test.go
index d033575f..0d94399e 100644
--- a/pkg/cloud/cloud_test.go
+++ b/pkg/cloud/cloud_test.go
@@ -30,7 +30,6 @@ import (
 	"github.com/aws/aws-sdk-go/service/ec2"
 	"github.com/golang/mock/gomock"
 	dm "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/devicemanager"
-	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/mocks"
 	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
 )
 
@@ -426,7 +425,7 @@ func TestCreateDisk(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			volState := tc.volState
@@ -528,7 +527,7 @@ func TestDeleteDisk(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ctx := context.Background()
@@ -582,7 +581,7 @@ func TestAttachDisk(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			vol := &ec2.Volume{
@@ -644,7 +643,7 @@ func TestDetachDisk(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			vol := &ec2.Volume{
@@ -713,7 +712,7 @@ func TestGetDiskByName(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			vol := &ec2.Volume{
@@ -795,7 +794,7 @@ func TestGetDiskByID(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ctx := context.Background()
@@ -894,7 +893,7 @@ func TestCreateSnapshot(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ec2snapshot := &ec2.Snapshot{
@@ -953,7 +952,7 @@ func TestDeleteSnapshot(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ctx := context.Background()
@@ -1084,7 +1083,7 @@ func TestResizeDisk(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			// reduce number of steps to reduce test time
 			volumeModificationWaitSteps = 3
 			c := newCloud(mockEC2)
@@ -1170,7 +1169,7 @@ func TestGetSnapshotByName(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ec2snapshot := &ec2.Snapshot{
@@ -1226,7 +1225,7 @@ func TestGetSnapshotByID(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			ec2snapshot := &ec2.Snapshot{
@@ -1286,7 +1285,7 @@ func TestListSnapshots(t *testing.T) {
 
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockEC2 := mocks.NewMockEC2(mockCtl)
+				mockEC2 := NewMockEC2(mockCtl)
 				c := newCloud(mockEC2)
 
 				ctx := context.Background()
@@ -1328,7 +1327,7 @@ func TestListSnapshots(t *testing.T) {
 
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockEC2 := mocks.NewMockEC2(mockCtl)
+				mockEC2 := NewMockEC2(mockCtl)
 				c := newCloud(mockEC2)
 
 				ctx := context.Background()
@@ -1375,7 +1374,7 @@ func TestListSnapshots(t *testing.T) {
 
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockEC2 := mocks.NewMockEC2(mockCtl)
+				mockEC2 := NewMockEC2(mockCtl)
 				c := newCloud(mockEC2)
 
 				ctx := context.Background()
@@ -1424,7 +1423,7 @@ func TestListSnapshots(t *testing.T) {
 			testFunc: func(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockEC2 := mocks.NewMockEC2(mockCtl)
+				mockEC2 := NewMockEC2(mockCtl)
 				c := newCloud(mockEC2)
 
 				ctx := context.Background()
@@ -1441,7 +1440,7 @@ func TestListSnapshots(t *testing.T) {
 			testFunc: func(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockEC2 := mocks.NewMockEC2(mockCtl)
+				mockEC2 := NewMockEC2(mockCtl)
 				c := newCloud(mockEC2)
 
 				ctx := context.Background()
@@ -1562,7 +1561,7 @@ func TestWaitForAttachmentState(t *testing.T) {
 	for _, tc := range testCases {
 		t.Run(tc.name, func(t *testing.T) {
 			mockCtrl := gomock.NewController(t)
-			mockEC2 := mocks.NewMockEC2(mockCtrl)
+			mockEC2 := NewMockEC2(mockCtrl)
 			c := newCloud(mockEC2)
 
 			attachedVol := &ec2.Volume{
diff --git a/pkg/cloud/metadata_test.go b/pkg/cloud/metadata_test.go
index d968b44f..9c645d76 100644
--- a/pkg/cloud/metadata_test.go
+++ b/pkg/cloud/metadata_test.go
@@ -25,7 +25,6 @@ import (
 	"github.com/aws/aws-sdk-go/aws/arn"
 	"github.com/aws/aws-sdk-go/aws/ec2metadata"
 	"github.com/golang/mock/gomock"
-	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/mocks"
 	v1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
@@ -285,7 +284,7 @@ func TestNewMetadataService(t *testing.T) {
 			}
 
 			mockCtrl := gomock.NewController(t)
-			mockEC2Metadata := mocks.NewMockEC2Metadata(mockCtrl)
+			mockEC2Metadata := NewMockEC2Metadata(mockCtrl)
 
 			ec2MetadataClient := func() (EC2Metadata, error) { return mockEC2Metadata, nil }
 			k8sAPIClient := func() (kubernetes.Interface, error) { clientsetInitialized = true; return clientset, nil }
diff --git a/pkg/driver/controller_test.go b/pkg/driver/controller_test.go
index 304ac34b..ae46cb37 100644
--- a/pkg/driver/controller_test.go
+++ b/pkg/driver/controller_test.go
@@ -32,7 +32,6 @@ import (
 	"github.com/golang/mock/gomock"
 	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
 	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
-	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/mocks"
 	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
@@ -105,7 +104,7 @@ func TestNewControllerService(t *testing.T) {
 			if tc.region == "" {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockMetadataService := mocks.NewMockMetadataService(mockCtl)
+				mockMetadataService := cloud.NewMockMetadataService(mockCtl)
 
 				oldNewMetadataFunc := NewMetadataFunc
 				defer func() { NewMetadataFunc = oldNewMetadataFunc }()
@@ -193,7 +192,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -263,7 +262,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -330,7 +329,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -386,7 +385,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -435,7 +434,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(nil, cloud.ErrIdempotentParameterMismatch)
 
 				awsDriver := controllerService{
@@ -463,7 +462,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -516,7 +515,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -602,7 +601,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -660,7 +659,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -721,7 +720,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -777,7 +776,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -819,7 +818,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -861,7 +860,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -902,7 +901,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -943,7 +942,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -984,7 +983,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1026,7 +1025,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1063,7 +1062,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1103,7 +1102,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1143,7 +1142,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1216,7 +1215,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1297,7 +1296,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Eq(diskOptions)).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1362,7 +1361,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Eq(diskOptions)).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1428,7 +1427,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Eq(diskOptions)).Return(mockDisk, nil)
 
 				awsDriver := controllerService{
@@ -1466,7 +1465,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1503,7 +1502,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				inFlight := internal.NewInFlight()
 				inFlight.Insert(req.GetName())
@@ -1537,7 +1536,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1573,7 +1572,7 @@ func TestCreateVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(nil, cloud.ErrIdempotentParameterMismatch)
 
 				awsDriver := controllerService{
@@ -1610,7 +1609,7 @@ func TestDeleteVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().DeleteDisk(gomock.Eq(ctx), gomock.Eq(req.VolumeId)).Return(true, nil)
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1642,7 +1641,7 @@ func TestDeleteVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().DeleteDisk(gomock.Eq(ctx), gomock.Eq(req.VolumeId)).Return(false, cloud.ErrNotFound)
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1673,7 +1672,7 @@ func TestDeleteVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().DeleteDisk(gomock.Eq(ctx), gomock.Eq(req.VolumeId)).Return(false, fmt.Errorf("DeleteDisk could not delete volume"))
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -1709,7 +1708,7 @@ func TestDeleteVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				inFlight := internal.NewInFlight()
 				inFlight.Insert(req.GetVolumeId())
 				defer inFlight.Delete(req.GetVolumeId())
@@ -1983,7 +1982,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateSnapshot(gomock.Eq(ctx), gomock.Eq(req.SourceVolumeId), gomock.Any()).Return(mockSnapshot, nil)
 				mockCloud.EXPECT().GetSnapshotByName(gomock.Eq(ctx), gomock.Eq(req.GetName())).Return(nil, cloud.ErrNotFound)
 
@@ -2040,7 +2039,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateSnapshot(gomock.Eq(ctx), gomock.Eq(req.SourceVolumeId), gomock.Eq(snapshotOptions)).Return(mockSnapshot, nil)
 				mockCloud.EXPECT().GetSnapshotByName(gomock.Eq(ctx), gomock.Eq(req.GetName())).Return(nil, cloud.ErrNotFound)
 
@@ -2095,7 +2094,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().CreateSnapshot(gomock.Eq(ctx), gomock.Eq(req.SourceVolumeId), gomock.Eq(snapshotOptions)).Return(mockSnapshot, nil)
 				mockCloud.EXPECT().GetSnapshotByName(gomock.Eq(ctx), gomock.Eq(req.GetName())).Return(nil, cloud.ErrNotFound)
 
@@ -2129,7 +2128,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2176,7 +2175,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().GetSnapshotByName(gomock.Eq(ctx), gomock.Eq(req.GetName())).Return(nil, cloud.ErrNotFound)
 				mockCloud.EXPECT().CreateSnapshot(gomock.Eq(ctx), gomock.Eq(req.SourceVolumeId), gomock.Any()).Return(mockSnapshot, nil)
 
@@ -2243,7 +2242,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().GetSnapshotByName(gomock.Eq(ctx), gomock.Eq(req.GetName())).Return(nil, cloud.ErrNotFound)
 				mockCloud.EXPECT().CreateSnapshot(gomock.Eq(ctx), gomock.Eq(req.SourceVolumeId), gomock.Any()).Return(mockSnapshot, nil)
 
@@ -2280,7 +2279,7 @@ func TestCreateSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				inFlight := internal.NewInFlight()
 				inFlight.Insert(req.GetName())
@@ -2315,7 +2314,7 @@ func TestDeleteSnapshot(t *testing.T) {
 
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2340,7 +2339,7 @@ func TestDeleteSnapshot(t *testing.T) {
 
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2366,7 +2365,7 @@ func TestDeleteSnapshot(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				req := &csi.DeleteSnapshotRequest{
 					SnapshotId: "test-snapshotID",
@@ -2424,7 +2423,7 @@ func TestListSnapshots(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().ListSnapshots(gomock.Eq(ctx), gomock.Eq(""), gomock.Eq(int64(0)), gomock.Eq("")).Return(mockCloudSnapshotsResponse, nil)
 
 				awsDriver := controllerService{
@@ -2451,7 +2450,7 @@ func TestListSnapshots(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().ListSnapshots(gomock.Eq(ctx), gomock.Eq(""), gomock.Eq(int64(0)), gomock.Eq("")).Return(nil, cloud.ErrNotFound)
 
 				awsDriver := controllerService{
@@ -2487,7 +2486,7 @@ func TestListSnapshots(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().GetSnapshotByID(gomock.Eq(ctx), gomock.Eq("snapshot-1")).Return(mockCloudSnapshotsResponse, nil)
 
 				awsDriver := controllerService{
@@ -2517,7 +2516,7 @@ func TestListSnapshots(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().GetSnapshotByID(gomock.Eq(ctx), gomock.Eq("snapshot-1")).Return(nil, cloud.ErrNotFound)
 
 				awsDriver := controllerService{
@@ -2547,7 +2546,7 @@ func TestListSnapshots(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().GetSnapshotByID(gomock.Eq(ctx), gomock.Eq("snapshot-1")).Return(nil, cloud.ErrMultiSnapshots)
 
 				awsDriver := controllerService{
@@ -2579,7 +2578,7 @@ func TestListSnapshots(t *testing.T) {
 				ctx := context.Background()
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().ListSnapshots(gomock.Eq(ctx), gomock.Eq(""), gomock.Eq(int64(4)), gomock.Eq("")).Return(nil, cloud.ErrInvalidMaxResults)
 
 				awsDriver := controllerService{
@@ -2640,7 +2639,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().IsExistInstance(gomock.Eq(ctx), gomock.Eq(req.NodeId)).Return(true)
 				mockCloud.EXPECT().GetDiskByID(gomock.Eq(ctx), gomock.Any()).Return(&cloud.Disk{}, nil)
 				mockCloud.EXPECT().AttachDisk(gomock.Eq(ctx), gomock.Any(), gomock.Eq(req.NodeId)).Return(expDevicePath, nil)
@@ -2675,7 +2674,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().DetachDisk(gomock.Eq(ctx), req.VolumeId, req.NodeId).Return(cloud.ErrNotFound)
 
 				awsDriver := controllerService{
@@ -2703,7 +2702,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2736,7 +2735,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2770,7 +2769,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2809,7 +2808,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -2844,7 +2843,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().IsExistInstance(gomock.Eq(ctx), gomock.Eq(req.NodeId)).Return(false)
 
 				awsDriver := controllerService{
@@ -2880,7 +2879,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().IsExistInstance(gomock.Eq(ctx), gomock.Eq(req.NodeId)).Return(true)
 				mockCloud.EXPECT().GetDiskByID(gomock.Eq(ctx), gomock.Any()).Return(nil, cloud.ErrNotFound)
 
@@ -2921,7 +2920,7 @@ func TestControllerPublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().IsExistInstance(gomock.Eq(ctx), gomock.Eq(req.NodeId)).Return(true)
 				mockCloud.EXPECT().GetDiskByID(gomock.Eq(ctx), gomock.Any()).Return(disk, nil)
 				mockCloud.EXPECT().AttachDisk(gomock.Eq(ctx), gomock.Any(), gomock.Eq(req.NodeId)).Return("", cloud.ErrVolumeInUse)
@@ -2974,7 +2973,7 @@ func TestControllerUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 				mockCloud.EXPECT().DetachDisk(gomock.Eq(ctx), req.VolumeId, req.NodeId).Return(nil)
 
 				awsDriver := controllerService{
@@ -3003,7 +3002,7 @@ func TestControllerUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -3036,7 +3035,7 @@ func TestControllerUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockCloud := mocks.NewMockCloud(mockCtl)
+				mockCloud := cloud.NewMockCloud(mockCtl)
 
 				awsDriver := controllerService{
 					cloud:         mockCloud,
@@ -3115,7 +3114,7 @@ func TestControllerExpandVolume(t *testing.T) {
 				retSizeGiB = util.BytesToGiB(tc.req.CapacityRange.GetRequiredBytes())
 			}
 
-			mockCloud := mocks.NewMockCloud(mockCtl)
+			mockCloud := cloud.NewMockCloud(mockCtl)
 			mockCloud.EXPECT().ResizeDisk(gomock.Eq(ctx), gomock.Eq(tc.req.VolumeId), gomock.Any()).Return(retSizeGiB, nil).AnyTimes()
 
 			awsDriver := controllerService{
diff --git a/pkg/driver/node_test.go b/pkg/driver/node_test.go
index 1b735fb1..c7273a6a 100644
--- a/pkg/driver/node_test.go
+++ b/pkg/driver/node_test.go
@@ -27,8 +27,8 @@ import (
 	"github.com/aws/aws-sdk-go/aws/arn"
 	"github.com/container-storage-interface/spec/lib/go/csi"
 	"github.com/golang/mock/gomock"
+	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
 	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
-	"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/mocks"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 )
@@ -55,7 +55,7 @@ func TestNodeStageVolume(t *testing.T) {
 		name         string
 		request      *csi.NodeStageVolumeRequest
 		inFlightFunc func(*internal.InFlight) *internal.InFlight
-		expectMock   func(mockMounter mocks.MockMounter)
+		expectMock   func(mockMounter MockMounter)
 		expectedCode codes.Code
 	}{
 		{
@@ -66,7 +66,7 @@ func TestNodeStageVolume(t *testing.T) {
 				VolumeCapability:  stdVolCap,
 				VolumeId:          "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -92,7 +92,7 @@ func TestNodeStageVolume(t *testing.T) {
 				},
 				VolumeId: "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				mockMounter.EXPECT().FormatAndMount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(0)
 			},
 		},
@@ -113,7 +113,7 @@ func TestNodeStageVolume(t *testing.T) {
 				},
 				VolumeId: "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -142,7 +142,7 @@ func TestNodeStageVolume(t *testing.T) {
 				},
 				VolumeId: "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -171,7 +171,7 @@ func TestNodeStageVolume(t *testing.T) {
 				},
 				VolumeId: "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -266,7 +266,7 @@ func TestNodeStageVolume(t *testing.T) {
 				VolumeCapability:  stdVolCap,
 				VolumeId:          "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -286,7 +286,7 @@ func TestNodeStageVolume(t *testing.T) {
 				VolumeContext:     stdVolContext,
 				VolumeId:          "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -306,7 +306,7 @@ func TestNodeStageVolume(t *testing.T) {
 				VolumeContext:     map[string]string{VolumeAttributePartition: "0"},
 				VolumeId:          "vol-test",
 			},
-			expectMock: func(mockMounter mocks.MockMounter) {
+			expectMock: func(mockMounter MockMounter) {
 				gomock.InOrder(
 					mockMounter.EXPECT().PathExists(gomock.Eq(devicePath)).Return(true, nil),
 					mockMounter.EXPECT().PathExists(gomock.Eq(targetPath)).Return(false, nil),
@@ -338,8 +338,8 @@ func TestNodeStageVolume(t *testing.T) {
 			mockCtl := gomock.NewController(t)
 			defer mockCtl.Finish()
 
-			mockMetadata := mocks.NewMockMetadataService(mockCtl)
-			mockMounter := mocks.NewMockMounter(mockCtl)
+			mockMetadata := cloud.NewMockMetadataService(mockCtl)
+			mockMounter := NewMockMounter(mockCtl)
 
 			inFlight := internal.NewInFlight()
 			if tc.inFlightFunc != nil {
@@ -380,8 +380,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -409,8 +409,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -436,8 +436,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -465,8 +465,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -488,8 +488,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -510,8 +510,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -536,8 +536,8 @@ func TestNodeUnstageVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -586,8 +586,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -619,8 +619,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -651,8 +651,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -684,8 +684,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -721,8 +721,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -763,8 +763,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -797,8 +797,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -843,8 +843,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -888,8 +888,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -932,8 +932,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -976,8 +976,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1026,8 +1026,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1072,8 +1072,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1118,8 +1118,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1153,8 +1153,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1187,8 +1187,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1224,8 +1224,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1251,8 +1251,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1278,8 +1278,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1305,8 +1305,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1331,8 +1331,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1363,8 +1363,8 @@ func TestNodePublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1403,8 +1403,8 @@ func TestNodeExpandVolume(t *testing.T) {
 	mockCtl := gomock.NewController(t)
 	defer mockCtl.Finish()
 
-	mockMetadata := mocks.NewMockMetadataService(mockCtl)
-	mockMounter := mocks.NewMockMounter(mockCtl)
+	mockMetadata := cloud.NewMockMetadataService(mockCtl)
+	mockMounter := NewMockMounter(mockCtl)
 
 	awsDriver := &nodeService{
 		metadata: mockMetadata,
@@ -1499,8 +1499,8 @@ func TestNodeUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1526,8 +1526,8 @@ func TestNodeUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1549,8 +1549,8 @@ func TestNodeUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1572,8 +1572,8 @@ func TestNodeUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1597,8 +1597,8 @@ func TestNodeUnpublishVolume(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 
 				awsDriver := &nodeService{
 					metadata: mockMetadata,
@@ -1634,8 +1634,8 @@ func TestNodeGetVolumeStats(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 				VolumePath := "./test"
 				err := os.MkdirAll(VolumePath, 0644)
 				if err != nil {
@@ -1667,8 +1667,8 @@ func TestNodeGetVolumeStats(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 				VolumePath := "/test"
 
 				mockMounter.EXPECT().PathExists(VolumePath).Return(false, nil)
@@ -1693,8 +1693,8 @@ func TestNodeGetVolumeStats(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 				VolumePath := "/test"
 
 				mockMounter.EXPECT().PathExists(VolumePath).Return(true, nil)
@@ -1719,8 +1719,8 @@ func TestNodeGetVolumeStats(t *testing.T) {
 				mockCtl := gomock.NewController(t)
 				defer mockCtl.Finish()
 
-				mockMetadata := mocks.NewMockMetadataService(mockCtl)
-				mockMounter := mocks.NewMockMounter(mockCtl)
+				mockMetadata := cloud.NewMockMetadataService(mockCtl)
+				mockMounter := NewMockMounter(mockCtl)
 				VolumePath := "/test"
 
 				mockMounter.EXPECT().PathExists(VolumePath).Return(false, errors.New("get existsPath call fail"))
@@ -1751,8 +1751,8 @@ func TestNodeGetCapabilities(t *testing.T) {
 	mockCtl := gomock.NewController(t)
 	defer mockCtl.Finish()
 
-	mockMetadata := mocks.NewMockMetadataService(mockCtl)
-	mockMounter := mocks.NewMockMounter(mockCtl)
+	mockMetadata := cloud.NewMockMetadataService(mockCtl)
+	mockMounter := NewMockMounter(mockCtl)
 
 	awsDriver := nodeService{
 		metadata: mockMetadata,
@@ -1866,9 +1866,9 @@ func TestNodeGetInfo(t *testing.T) {
 				volumeAttachLimit: tc.volumeAttachLimit,
 			}
 
-			mockMounter := mocks.NewMockMounter(mockCtl)
+			mockMounter := NewMockMounter(mockCtl)
 
-			mockMetadata := mocks.NewMockMetadataService(mockCtl)
+			mockMetadata := cloud.NewMockMetadataService(mockCtl)
 			mockMetadata.EXPECT().GetInstanceID().Return(tc.instanceID)
 			mockMetadata.EXPECT().GetAvailabilityZone().Return(tc.availabilityZone)
 			mockMetadata.EXPECT().GetOutpostArn().Return(tc.outpostArn)