github.com/opentofu/opentofu@v1.7.1/internal/command/views/json/test.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 package json 7 8 import ( 9 "strings" 10 11 "github.com/opentofu/opentofu/internal/moduletest" 12 ) 13 14 type TestSuiteAbstract map[string][]string 15 16 type TestStatus string 17 18 type TestFileStatus struct { 19 Path string `json:"path"` 20 Status TestStatus `json:"status"` 21 } 22 23 type TestRunStatus struct { 24 Path string `json:"path"` 25 Run string `json:"run"` 26 Status TestStatus `json:"status"` 27 } 28 29 type TestSuiteSummary struct { 30 Status TestStatus `json:"status"` 31 Passed int `json:"passed"` 32 Failed int `json:"failed"` 33 Errored int `json:"errored"` 34 Skipped int `json:"skipped"` 35 } 36 37 type TestFileCleanup struct { 38 FailedResources []TestFailedResource `json:"failed_resources"` 39 } 40 41 type TestFailedResource struct { 42 Instance string `json:"instance"` 43 DeposedKey string `json:"deposed_key,omitempty"` 44 } 45 46 type TestFatalInterrupt struct { 47 State []TestFailedResource `json:"state,omitempty"` 48 States map[string][]TestFailedResource `json:"states,omitempty"` 49 Planned []string `json:"planned,omitempty"` 50 } 51 52 func ToTestStatus(status moduletest.Status) TestStatus { 53 return TestStatus(strings.ToLower(status.String())) 54 }