github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/views/json/test.go (about)

     1  package json
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/terramate-io/tf/moduletest"
     7  )
     8  
     9  type TestSuiteAbstract map[string][]string
    10  
    11  type TestStatus string
    12  
    13  type TestFileStatus struct {
    14  	Path   string     `json:"path"`
    15  	Status TestStatus `json:"status"`
    16  }
    17  
    18  type TestRunStatus struct {
    19  	Path   string     `json:"path"`
    20  	Run    string     `json:"run"`
    21  	Status TestStatus `json:"status"`
    22  }
    23  
    24  type TestSuiteSummary struct {
    25  	Status  TestStatus `json:"status"`
    26  	Passed  int        `json:"passed"`
    27  	Failed  int        `json:"failed"`
    28  	Errored int        `json:"errored"`
    29  	Skipped int        `json:"skipped"`
    30  }
    31  
    32  type TestFileCleanup struct {
    33  	FailedResources []TestFailedResource `json:"failed_resources"`
    34  }
    35  
    36  type TestFailedResource struct {
    37  	Instance   string `json:"instance"`
    38  	DeposedKey string `json:"deposed_key,omitempty"`
    39  }
    40  
    41  type TestFatalInterrupt struct {
    42  	State   []TestFailedResource            `json:"state,omitempty"`
    43  	States  map[string][]TestFailedResource `json:"states,omitempty"`
    44  	Planned []string                        `json:"planned,omitempty"`
    45  }
    46  
    47  func ToTestStatus(status moduletest.Status) TestStatus {
    48  	return TestStatus(strings.ToLower(status.String()))
    49  }