Add Markitect check fixtures
This commit is contained in:
parent
96e53bf1d9
commit
7e09a21c5f
5 changed files with 457 additions and 4 deletions
|
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
|
@ -413,15 +412,21 @@ func expectationMatches(expected, actual api.DecisionExpectation) bool {
|
|||
if expected.Reason != "" && expected.Reason != actual.Reason {
|
||||
return false
|
||||
}
|
||||
if len(expected.Obligations) > 0 && !reflect.DeepEqual(expected.Obligations, actual.Obligations) {
|
||||
if len(expected.Obligations) > 0 && !jsonEqual(expected.Obligations, actual.Obligations) {
|
||||
return false
|
||||
}
|
||||
if len(expected.ConformanceFindings) > 0 && !reflect.DeepEqual(expected.ConformanceFindings, actual.ConformanceFindings) {
|
||||
if len(expected.ConformanceFindings) > 0 && !jsonEqual(expected.ConformanceFindings, actual.ConformanceFindings) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func jsonEqual(left, right any) bool {
|
||||
leftData, leftErr := json.Marshal(left)
|
||||
rightData, rightErr := json.Marshal(right)
|
||||
return leftErr == nil && rightErr == nil && string(leftData) == string(rightData)
|
||||
}
|
||||
|
||||
func toRegoInput(value any) (map[string]any, error) {
|
||||
data, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue