Files
opentf/internal/command/views/json/test.go
2024-02-08 09:48:59 +00:00

55 lines
1.3 KiB
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package json
import (
"strings"
"github.com/opentofu/opentofu/internal/moduletest"
)
type TestSuiteAbstract map[string][]string
type TestStatus string
type TestFileStatus struct {
Path string `json:"path"`
Status TestStatus `json:"status"`
}
type TestRunStatus struct {
Path string `json:"path"`
Run string `json:"run"`
Status TestStatus `json:"status"`
}
type TestSuiteSummary struct {
Status TestStatus `json:"status"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Errored int `json:"errored"`
Skipped int `json:"skipped"`
}
type TestFileCleanup struct {
FailedResources []TestFailedResource `json:"failed_resources"`
}
type TestFailedResource struct {
Instance string `json:"instance"`
DeposedKey string `json:"deposed_key,omitempty"`
}
type TestFatalInterrupt struct {
State []TestFailedResource `json:"state,omitempty"`
States map[string][]TestFailedResource `json:"states,omitempty"`
Planned []string `json:"planned,omitempty"`
}
func ToTestStatus(status moduletest.Status) TestStatus {
return TestStatus(strings.ToLower(status.String()))
}