Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armstrong test - hide readonly array item in coverage report #103

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading