Skip to content

Commit

Permalink
cleanup / fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-schndr committed Nov 20, 2023
1 parent ccce9dd commit 7f43fe0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion pkg/frontend/adminactions/delete_managedresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
)

func (a *azureActions) ResourceDeleteAndWait(ctx context.Context, resourceID string) error {

idParts, err := azure.ParseResourceID(resourceID)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/adminactions/delete_managedresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func TestDeleteManagedResource(t *testing.T) {
if tt.expectedErr != nil {
assert.Equal(t, tt.expectedErr, err, "Unexpected error exception")
} else {
assert.Equal(t, nil, err, "Unexpected error exception")
assert.NoError(t, nil, err, "Unexpected error exception")

Check failure on line 174 in pkg/frontend/adminactions/delete_managedresource_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

error-is-as: invalid usage of assert.NoError, use assert.NotErrorIs instead (testifylint)
}
})
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/util/loadbalancer/loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (

var infraID = "infraID"
var location = "eastus"
var subscription = "00000000-0000-0000-0000-000000000000"
var clusterRG = "clusterRG"
var publicIngressFIPConfigID = to.StringPtr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clusterRG/providers/Microsoft.Network/loadBalancers/infraID/frontendIPConfigurations/ae3506385907e44eba9ef9bf76eac973")
var originalLB = mgmtnetwork.LoadBalancer{
Sku: &mgmtnetwork.LoadBalancerSku{
Expand Down Expand Up @@ -126,12 +124,11 @@ func TestRemoveLoadBalancerFrontendIPConfiguration(t *testing.T) {
},
} {
t.Run(tt.name, func(t *testing.T) {
// Run addOutboundIPsToLB and assert the correct results
err := RemoveFrontendIPConfiguration(&tt.currentLB, tt.fipResourceID)
if tt.expectedErr != nil {
assert.Equal(t, tt.expectedErr, err, "Unexpected error exception")
} else {
assert.Equal(t, nil, err, "Unexpected error exception")
assert.NoError(t, nil, err, "Unexpected error exception")

Check failure on line 131 in pkg/util/loadbalancer/loadbalancer_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

error-is-as: invalid usage of assert.NoError, use assert.NotErrorIs instead (testifylint)
}
assert.Equal(t, tt.expectedLB, tt.currentLB)
})
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/adminapi_delete_managedresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = Describe("[Admin API] Delete managed resource action", func() {
Eventually(func(g Gomega, ctx context.Context) {
service, err = clients.Kubernetes.CoreV1().Services("default").Get(ctx, "test", metav1.GetOptions{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(len(service.Status.LoadBalancer.Ingress)).To(Equal(1))
g.Expect(service.Status.LoadBalancer.Ingress).To(HaveLen(1))
}).WithContext(ctx).WithTimeout(DefaultEventuallyTimeout).Should(Succeed())

By("getting the newly created k8s service frontend IP configuration")
Expand All @@ -73,8 +73,11 @@ var _ = Describe("[Admin API] Delete managed resource action", func() {

rgName := stringutils.LastTokenByte(*oc.OpenShiftClusterProperties.ClusterProfile.ResourceGroupID, '/')
lbName, err := getPublicLoadBalancerName(ctx)
Expect(err).NotTo(HaveOccurred())

lb, err := clients.LoadBalancers.Get(ctx, rgName, lbName, "")
Expect(err).NotTo(HaveOccurred())

for _, fipConfig := range *lb.LoadBalancerPropertiesFormat.FrontendIPConfigurations {
if !strings.Contains(*fipConfig.PublicIPAddress.ID, "default-v4") && !strings.Contains(*fipConfig.PublicIPAddress.ID, "pip-v4") {
lbRuleID = *(*fipConfig.LoadBalancingRules)[0].ID
Expand All @@ -99,6 +102,7 @@ var _ = Describe("[Admin API] Delete managed resource action", func() {
Expect(err).NotTo(HaveOccurred())

resp, err := adminRequest(ctx, http.MethodPost, "/admin"+clusterResourceID+"/deletemanagedresource", url.Values{"resourceid": []string{*oc.OpenShiftClusterProperties.MasterProfile.SubnetID}}, true, nil, nil)
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(http.StatusBadRequest))
})
})
Expand Down

0 comments on commit 7f43fe0

Please sign in to comment.