Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Troy Connor <[email protected]>
  • Loading branch information
troy0820 committed Nov 22, 2023
1 parent 9d36c4c commit fabe9e8
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 7 deletions.
3 changes: 3 additions & 0 deletions azure/services/privateendpoints/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import (
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
)

// PrivateEndpointsClient is an interface that the sdk to be injected for
// testing.
// In production we use the azure-sdk-for-go which utilizes these methods.
type PrivateEndpointsClient interface {
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters armnetwork.PrivateEndpoint, options *armnetwork.PrivateEndpointsClientBeginCreateOrUpdateOptions) (*runtime.Poller[armnetwork.PrivateEndpointsClientCreateOrUpdateResponse], error)
BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointName string, options *armnetwork.PrivateEndpointsClientBeginDeleteOptions) (*runtime.Poller[armnetwork.PrivateEndpointsClientDeleteResponse], error)
Expand Down
17 changes: 16 additions & 1 deletion azure/services/privateendpoints/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package privateendpoints

import (
Expand Down Expand Up @@ -72,5 +88,4 @@ func TestCreateOrUpdateAsync(t *testing.T) {
}
_, _, err := ac.CreateOrUpdateAsync(ctx, rsp, "resume", pe)
g.Expect(err).To(HaveOccurred())

}
3 changes: 3 additions & 0 deletions azure/services/resourcehealth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type client interface {
GetByResource(context.Context, string) (armresourcehealth.AvailabilityStatus, error)
}

// AvailabilityStatusesClient is an interface that the sdk to be injected for
// testing.
// In production we use the azure-sdk-for-go which utilizes these methods.
type AvailabilityStatusesClient interface {
GetByResource(ctx context.Context, resourceURI string, options *armresourcehealth.AvailabilityStatusesClientGetByResourceOptions) (armresourcehealth.AvailabilityStatusesClientGetByResourceResponse, error)
}
Expand Down
17 changes: 16 additions & 1 deletion azure/services/resourcehealth/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package resourcehealth

import (
Expand All @@ -7,7 +23,6 @@ import (

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth"
. "github.com/onsi/gomega"

"go.uber.org/mock/gomock"
"sigs.k8s.io/cluster-api-provider-azure/azure/services/resourcehealth/mock_resourcehealth"
)
Expand Down
2 changes: 2 additions & 0 deletions azure/services/subnets/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
)

// SubnetsClient is an interface that the sdk to be injected for testing.
// In production we use the azure-sdk-for-go which utilizes these methods.
type SubnetsClient interface {
Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *armnetwork.SubnetsClientGetOptions) (armnetwork.SubnetsClientGetResponse, error)
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters armnetwork.Subnet, options *armnetwork.SubnetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[armnetwork.SubnetsClientCreateOrUpdateResponse], error)
Expand Down
18 changes: 16 additions & 2 deletions azure/services/subnets/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package subnets

import (
Expand Down Expand Up @@ -77,7 +93,6 @@ func TestCreateOrUpdateAsync(t *testing.T) {
}
_, _, err := ac.CreateOrUpdateAsync(ctx, rsp, "resume", sub)
g.Expect(err).To(HaveOccurred())

}

func TestDeleteAsync(t *testing.T) {
Expand All @@ -100,5 +115,4 @@ func TestDeleteAsync(t *testing.T) {
}
_, err := ac.DeleteAsync(ctx, rsp, "resume")
g.Expect(err).To(HaveOccurred())

}
1 change: 1 addition & 0 deletions azure/services/subnets/mock_subnets/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ limitations under the License.
//go:generate ../../../../hack/tools/bin/mockgen -destination subnets_mock.go -package mock_subnets -source ../subnets.go SubnetScope
//go:generate ../../../../hack/tools/bin/mockgen -destination subnets_clients_mock.go -package mock_subnets -source ../client.go SubnetsClient
//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt subnets_mock.go > _subnets_mock.go && mv _subnets_mock.go subnets_mock.go"
//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt subnets_clients_mock.go > _subnets_clients_mock.go && mv _subnets_clients_mock.go subnets_clients_mock.go"
package mock_subnets
16 changes: 16 additions & 0 deletions azure/services/subnets/mock_subnets/subnets_clients_mock.go

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

2 changes: 2 additions & 0 deletions azure/services/tags/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type client interface {
UpdateAtScope(context.Context, string, armresources.TagsPatchResource) (armresources.TagsResource, error)
}

// TagsClient is an interface that the sdk to be injected for testing.
// In production we use the azure-sdk-for-go which utilizes these methods.
type TagsClient interface {
GetAtScope(ctx context.Context, scope string, options *armresources.TagsClientGetAtScopeOptions) (armresources.TagsClientGetAtScopeResponse, error)
UpdateAtScope(ctx context.Context, scope string, parameters armresources.TagsPatchResource, options *armresources.TagsClientUpdateAtScopeOptions) (armresources.TagsClientUpdateAtScopeResponse, error)
Expand Down
17 changes: 16 additions & 1 deletion azure/services/tags/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package tags

import (
Expand Down Expand Up @@ -77,6 +93,5 @@ func TestUpdateAtScope(t *testing.T) {
g.Expect(err).To(HaveOccurred())
}
})

}
}
3 changes: 3 additions & 0 deletions azure/services/virtualmachines/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type AzureClient struct {
virtualmachines VirtualMachinesClient
}

// VirtualMachinesClient is an interface that the sdk to be injected for
// testing.
// In production we use the azure-sdk-for-go which utilizes these methods.
type VirtualMachinesClient interface {
BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters armcompute.VirtualMachine, options *armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions) (*runtime.Poller[armcompute.VirtualMachinesClientCreateOrUpdateResponse], error)
BeginDelete(ctx context.Context, resourceGroupName string, vmName string, options *armcompute.VirtualMachinesClientBeginDeleteOptions) (*runtime.Poller[armcompute.VirtualMachinesClientDeleteResponse], error)
Expand Down
18 changes: 16 additions & 2 deletions azure/services/virtualmachines/client_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package virtualmachines

import (
Expand Down Expand Up @@ -72,7 +88,6 @@ func TestCreateOrUpdateAsync(t *testing.T) {
}
_, _, err := ac.CreateOrUpdateAsync(ctx, rsp, "resume", vm)
g.Expect(err).To(HaveOccurred())

}

func TestDeleteAsync(t *testing.T) {
Expand All @@ -94,5 +109,4 @@ func TestDeleteAsync(t *testing.T) {
}
_, err := ac.DeleteAsync(ctx, rsp, "resume")
g.Expect(err).To(HaveOccurred())

}

0 comments on commit fabe9e8

Please sign in to comment.