Skip to content

Commit

Permalink
fix: add panicChan to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benwaples committed Mar 19, 2024
1 parent 285841e commit 96518b3
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cmd/list-app-owners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestListAppOwners(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureADAppOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockAppOwnerChannel).Times(1)
mockClient.EXPECT().ListAzureADAppOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockAppOwnerChannel2).Times(1)
channel := listAppOwners(ctx, mockClient, mockAppsChannel)
channel := listAppOwners(ctx, mockClient, panicChan(), mockAppsChannel)

go func() {
defer close(mockAppsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListApps(t *testing.T) {
}
}()

channel := listApps(ctx, mockClient)
channel := listApps(ctx, mockClient, panicChan())
<-channel
if _, ok := <-channel; ok {
t.Error("expected channel to close from an error result but it did not")
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-device-owners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListDeviceOwners(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureDeviceRegisteredOwners(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockDeviceOwnerChannel).Times(1)
mockClient.EXPECT().ListAzureDeviceRegisteredOwners(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockDeviceOwnerChannel2).Times(1)
channel := listDeviceOwners(ctx, mockClient, mockDevicesChannel)
channel := listDeviceOwners(ctx, mockClient, panicChan(), mockDevicesChannel)

go func() {
defer close(mockDevicesChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListDevices(t *testing.T) {
}
}()

channel := listDevices(ctx, mockClient)
channel := listDevices(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-group-members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListGroupMembers(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureADGroupMembers(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockGroupMemberChannel).Times(1)
mockClient.EXPECT().ListAzureADGroupMembers(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockGroupMemberChannel2).Times(1)
channel := listGroupMembers(ctx, mockClient, mockGroupsChannel)
channel := listGroupMembers(ctx, mockClient, panicChan(), mockGroupsChannel)

go func() {
defer close(mockGroupsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-group-owners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListGroupOwners(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureADGroupOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockGroupOwnerChannel).Times(1)
mockClient.EXPECT().ListAzureADGroupOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockGroupOwnerChannel2).Times(1)
channel := listGroupOwners(ctx, mockClient, mockGroupsChannel)
channel := listGroupOwners(ctx, mockClient, panicChan(), mockGroupsChannel)

go func() {
defer close(mockGroupsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestListGroups(t *testing.T) {
}
}()

channel := listGroups(ctx, mockClient)
channel := listGroups(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-key-vault-access-policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestListKeyVaultAccessPolicies(t *testing.T) {
mockKeyVaultsChannel := make(chan interface{})
mockTenant := azure.Tenant{}
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
channel := listKeyVaultAccessPolicies(ctx, mockClient, mockKeyVaultsChannel, nil)
channel := listKeyVaultAccessPolicies(ctx, mockClient, panicChan(), mockKeyVaultsChannel, nil)

go func() {
defer close(mockKeyVaultsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-key-vault-role-assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListKeyVaultRoleAssignments(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockKeyVaultRoleAssignmentChannel).Times(1)
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockKeyVaultRoleAssignmentChannel2).Times(1)
channel := listKeyVaultRoleAssignments(ctx, mockClient, mockKeyVaultsChannel)
channel := listKeyVaultRoleAssignments(ctx, mockClient, panicChan(), mockKeyVaultsChannel)

go func() {
defer close(mockKeyVaultsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-key-vaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestListKeyVaults(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureKeyVaults(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockKeyVaultChannel).Times(1)
mockClient.EXPECT().ListAzureKeyVaults(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockKeyVaultChannel2).Times(1)
channel := listKeyVaults(ctx, mockClient, mockSubscriptionsChannel)
channel := listKeyVaults(ctx, mockClient, panicChan(), mockSubscriptionsChannel)

go func() {
defer close(mockSubscriptionsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-management-group-descendants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestListManagementGroupDescendants(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureManagementGroupDescendants(gomock.Any(), gomock.Any()).Return(mockManagementGroupDescendantChannel).Times(1)
mockClient.EXPECT().ListAzureManagementGroupDescendants(gomock.Any(), gomock.Any()).Return(mockManagementGroupDescendantChannel2).Times(1)
channel := listManagementGroupDescendants(ctx, mockClient, mockManagementGroupsChannel)
channel := listManagementGroupDescendants(ctx, mockClient, panicChan(), mockManagementGroupsChannel)

go func() {
defer close(mockManagementGroupsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-management-group-role-assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListResourceGroupRoleAssignments(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockResourceGroupRoleAssignmentChannel).Times(1)
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockResourceGroupRoleAssignmentChannel2).Times(1)
channel := listResourceGroupRoleAssignments(ctx, mockClient, mockResourceGroupsChannel)
channel := listResourceGroupRoleAssignments(ctx, mockClient, panicChan(), mockResourceGroupsChannel)

go func() {
defer close(mockResourceGroupsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-management-groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListManagementGroups(t *testing.T) {
}
}()

channel := listManagementGroups(ctx, mockClient)
channel := listManagementGroups(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-resource-group-role-assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListManagementGroupRoleAssignments(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockManagementGroupRoleAssignmentChannel).Times(1)
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockManagementGroupRoleAssignmentChannel2).Times(1)
channel := listManagementGroupRoleAssignments(ctx, mockClient, mockManagementGroupsChannel)
channel := listManagementGroupRoleAssignments(ctx, mockClient, panicChan(), mockManagementGroupsChannel)

go func() {
defer close(mockManagementGroupsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-resource-groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestListResourceGroups(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureResourceGroups(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockResourceGroupChannel).Times(1)
mockClient.EXPECT().ListAzureResourceGroups(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockResourceGroupChannel2).Times(1)
channel := listResourceGroups(ctx, mockClient, mockSubscriptionsChannel)
channel := listResourceGroups(ctx, mockClient, panicChan(), mockSubscriptionsChannel)

go func() {
defer close(mockSubscriptionsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListRoles(t *testing.T) {
}
}()

channel := listRoles(ctx, mockClient)
channel := listRoles(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-service-principal-owners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListServicePrincipalOwners(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureADServicePrincipalOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockServicePrincipalOwnerChannel).Times(1)
mockClient.EXPECT().ListAzureADServicePrincipalOwners(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(mockServicePrincipalOwnerChannel2).Times(1)
channel := listServicePrincipalOwners(ctx, mockClient, mockServicePrincipalsChannel)
channel := listServicePrincipalOwners(ctx, mockClient, panicChan(), mockServicePrincipalsChannel)

go func() {
defer close(mockServicePrincipalsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-service-principals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListServicePrincipals(t *testing.T) {
}
}()

channel := listServicePrincipals(ctx, mockClient)
channel := listServicePrincipals(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-subscription-owners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestListSubscriptionOwners(t *testing.T) {
mockRoleAssignmentsChannel := make(chan interface{})
mockTenant := azure.Tenant{}
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
channel := listSubscriptionOwners(ctx, mockClient, mockRoleAssignmentsChannel)
channel := listSubscriptionOwners(ctx, mockClient, panicChan(), mockRoleAssignmentsChannel)

go func() {
defer close(mockRoleAssignmentsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-subscription-role-assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListSubscriptionRoleAssignments(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockSubscriptionRoleAssignmentChannel).Times(1)
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockSubscriptionRoleAssignmentChannel2).Times(1)
channel := listSubscriptionRoleAssignments(ctx, mockClient, mockSubscriptionsChannel)
channel := listSubscriptionRoleAssignments(ctx, mockClient, panicChan(), mockSubscriptionsChannel)

go func() {
defer close(mockSubscriptionsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-subscription-user-access-admins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestListSubscriptionUserAccessAdmins(t *testing.T) {
mockRoleAssignmentsChannel := make(chan interface{})
mockTenant := azure.Tenant{}
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
channel := listSubscriptionUserAccessAdmins(ctx, mockClient, mockRoleAssignmentsChannel)
channel := listSubscriptionUserAccessAdmins(ctx, mockClient, panicChan(), mockRoleAssignmentsChannel)

go func() {
defer close(mockRoleAssignmentsChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListSubscriptions(t *testing.T) {
}
}()

channel := listSubscriptions(ctx, mockClient)
channel := listSubscriptions(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestListTenants(t *testing.T) {
}
}()

channel := listTenants(ctx, mockClient)
channel := listTenants(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestListUsers(t *testing.T) {
}
}()

channel := listUsers(ctx, mockClient)
channel := listUsers(ctx, mockClient, panicChan())
result := <-channel
if _, ok := result.(AzureWrapper); !ok {
t.Errorf("failed type assertion: got %T, want %T", result, AzureWrapper{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-virtual-machine-role-assignments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListVirtualMachineRoleAssignments(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockVirtualMachineRoleAssignmentChannel).Times(1)
mockClient.EXPECT().ListRoleAssignmentsForResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockVirtualMachineRoleAssignmentChannel2).Times(1)
channel := listVirtualMachineRoleAssignments(ctx, mockClient, mockVirtualMachinesChannel)
channel := listVirtualMachineRoleAssignments(ctx, mockClient, panicChan(), mockVirtualMachinesChannel)

go func() {
defer close(mockVirtualMachinesChannel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/list-virtual-machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestListVirtualMachines(t *testing.T) {
mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes()
mockClient.EXPECT().ListAzureVirtualMachines(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockVirtualMachineChannel).Times(1)
mockClient.EXPECT().ListAzureVirtualMachines(gomock.Any(), gomock.Any(), gomock.Any()).Return(mockVirtualMachineChannel2).Times(1)
channel := listVirtualMachines(ctx, mockClient, mockSubscriptionsChannel)
channel := listVirtualMachines(ctx, mockClient, panicChan(), mockSubscriptionsChannel)

go func() {
defer close(mockSubscriptionsChannel)
Expand Down

0 comments on commit 96518b3

Please sign in to comment.