test: remove duplicate test case
parent
77a8227a4d
commit
edb5de32c0
|
@ -1207,58 +1207,3 @@ func TestAnalysis_UnmarshalJSON(t *testing.T) {
|
|||
assert.Len(t, got.alerts, 1)
|
||||
assert.Equal(t, got.alerts["aws_iam_access_key"][0].Message(), "This is an alert")
|
||||
}
|
||||
|
||||
func TestAnalysis_Sort(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
iac []resource.Resource
|
||||
cloud []resource.Resource
|
||||
expected Analysis
|
||||
}{
|
||||
{
|
||||
name: "unmanaged resources are sorted",
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
filter := &mocks.Filter{}
|
||||
filter.On("IsResourceIgnored", mock.Anything).Return(false)
|
||||
filter.On("IsFieldIgnored", mock.Anything, mock.Anything).Return(false)
|
||||
|
||||
al := alerter.NewAlerter()
|
||||
|
||||
analyzer := NewAnalyzer(al)
|
||||
result, err := analyzer.Analyze(c.cloud, c.iac, filter)
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for i, expected := range c.expected.Unmanaged() {
|
||||
actual := result.Unmanaged()[i]
|
||||
|
||||
unmanagedChanges, err := diff.Diff(actual, expected)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to compare %+v", err)
|
||||
}
|
||||
if len(unmanagedChanges) > 0 {
|
||||
for _, change := range unmanagedChanges {
|
||||
t.Errorf("%+v", change)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deletedChanges, err := diff.Diff(result.Deleted(), c.expected.Deleted())
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to compare %+v", err)
|
||||
}
|
||||
if len(deletedChanges) > 0 {
|
||||
for _, change := range deletedChanges {
|
||||
t.Errorf("%+v", change)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue