Skip to content

Commit

Permalink
added test for nil IPAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Feb 21, 2023
1 parent 54ed684 commit 7e8d7fb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/scanners/ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func newContainerInstanceWithPrivateEndpoints(t *testing.T) *armcontainerinstanc
return svc
}

func newContainerInstanceWithoutIPAdress(t *testing.T) *armcontainerinstance.ContainerGroup {
svc := newContainerInstance(t)
svc.Properties.IPAddress = nil
return svc
}

func newContainerInstanceResult(t *testing.T) AzureServiceResult {
return AzureServiceResult{
SubscriptionID: "subscriptionId",
Expand Down Expand Up @@ -68,6 +74,13 @@ func newContainerInstancePrivateEndpointResult(t *testing.T) AzureServiceResult
return svc
}

func newContainerInstanceWithoutIPAddressResult(t *testing.T) AzureServiceResult {
svc := newContainerInstanceResult(t)
svc.PrivateEndpoints = false
return svc
}


func TestContainerInstanceScanner_Scan(t *testing.T) {
type args struct {
resourceGroupName string
Expand Down Expand Up @@ -101,6 +114,7 @@ func TestContainerInstanceScanner_Scan(t *testing.T) {
newContainerInstance(t),
newContainerInstanceWithAvailabilityZones(t),
newContainerInstanceWithPrivateEndpoints(t),
newContainerInstanceWithoutIPAdress(t),
},
nil
},
Expand All @@ -112,6 +126,7 @@ func TestContainerInstanceScanner_Scan(t *testing.T) {
newContainerInstanceResult(t),
newContainerInstanceAvailabilityZonesResult(t),
newContainerInstancePrivateEndpointResult(t),
newContainerInstanceWithoutIPAddressResult(t),
},
wantErr: false,
},
Expand Down

0 comments on commit 7e8d7fb

Please sign in to comment.