Skip to content

Commit

Permalink
hide readonly array
Browse files Browse the repository at this point in the history
  • Loading branch information
teowa committed May 27, 2024
1 parent 376b02b commit 65bf7ea
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions coverage/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ func (m *Model) CountCoverage() (int, int) {
if v.IsReadOnly {
continue
}
if v.Item != nil && v.Item.IsReadOnly {
continue
}
covered, total := v.CountCoverage()
m.CoveredCount += covered
m.TotalCount += total
Expand Down
36 changes: 35 additions & 1 deletion coverage/coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func TestCoverage_DataMigrationServiceTasks(t *testing.T) {
name: "DataMigrationServiceTasks",
resourceType: "Microsoft.DataMigration/services/serviceTasks@2021-06-30",
apiVersion: "2021-06-30",
apiPath: "/subscriptions/fc04246f-04c5-437e-ac5e-206a19e7193f/resourceGroups/DmsSdkRg/providers/Microsoft.DataMigration/services/DmsSdkService/serviceTasks/DmsSdkTask",
apiPath: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/DmsSdkRg/providers/Microsoft.DataMigration/services/DmsSdkService/serviceTasks/DmsSdkTask",
rawRequest: []string{
`{
"properties": {
Expand All @@ -226,6 +226,40 @@ func TestCoverage_DataMigrationServiceTasks(t *testing.T) {
}
}

func TestCoverage_SCVMM(t *testing.T) {
tc := testCase{
name: "SCVMM",
resourceType: "Microsoft.ScVmm/virtualMachineInstances@2023-10-07",
apiVersion: "2023-10-07",
apiPath: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/cli-test-rg-vmm/providers/Microsoft.HybridCompute/machines/test-vm-tf/providers/Microsoft.ScVmm/virtualMachineInstances/default",
rawRequest: []string{
`{
"extendedLocation": {
"name": "/subscriptions/12345678-1234-9876-4563-123456789012/resourcegroups/syntheticsscvmmcan/providers/microsoft.extendedlocation/customlocations/terraform-test-cl",
"type": "customLocation"
},
"properties": {
"infrastructureProfile": {
"cloudId": "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/cli-test-rg-vmm/providers/Microsoft.SCVMM/Clouds/azcli-test-cloud",
"templateId": "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/cli-test-rg-vmm/providers/Microsoft.SCVMM/VirtualMachineTemplates/azcli-test-vm-template-win19",
"vmmServerId": "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/SyntheticsSCVMMCan/providers/microsoft.scvmm/vmmservers/tf-test-vmmserver"
}
}
}`,
},
}

model, err := testCoverage(t, tc)
if err != nil {
t.Fatalf("process coverage: %+v", err)
}

expected := 5
if model.CoveredCount != expected {
t.Fatalf("expected CoveredCount %d, got %d", expected, model.CoveredCount)
}
}

func TestCoverage_DataMigrationTasks(t *testing.T) {
tc := testCase{
name: "DataMigrationTasks",
Expand Down
4 changes: 4 additions & 0 deletions report/pass_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func getReport(model *coverage.Model) []string {
continue
}

if v.Item != nil && v.Item.IsReadOnly {
continue
}

if v.Variants != nil {
variantType := v.ModelName
if v.VariantType != nil {
Expand Down

0 comments on commit 65bf7ea

Please sign in to comment.