Cleanup unnecessary normalizing method (#11169)

This commit is contained in:
Chris S. Kim 2021-09-28 15:31:12 -04:00 committed by GitHub
parent 4ed9476a61
commit 3f79aaf509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 10 deletions

View File

@ -75,7 +75,7 @@ func TestIntentionApply_new(t *testing.T) {
//nolint:staticcheck
ixn.Intention.UpdatePrecedence()
// Partition fields will be normalized on Intention.Get
ixn.Intention.NormalizePartitionFields()
ixn.Intention.FillPartitionAndNamespace(nil, true)
require.Equal(t, ixn.Intention, actual)
}
@ -269,7 +269,7 @@ func TestIntentionApply_updateGood(t *testing.T) {
//nolint:staticcheck
ixn.Intention.UpdatePrecedence()
// Partition fields will be normalized on Intention.Get
ixn.Intention.NormalizePartitionFields()
ixn.Intention.FillPartitionAndNamespace(nil, true)
require.Equal(t, ixn.Intention, actual)
}
}

View File

@ -156,7 +156,7 @@ func TestStore_IntentionSetGet_basic(t *testing.T) {
//nolint:staticcheck
expected.SetHash()
expected.NormalizePartitionFields()
expected.FillPartitionAndNamespace(nil, true)
}
require.True(t, watchFired(ws), "watch fired")
@ -1098,7 +1098,7 @@ func TestStore_IntentionsList(t *testing.T) {
UpdatedAt: testTimeA,
}
if !legacy {
ret.NormalizePartitionFields()
ret.FillPartitionAndNamespace(nil, true)
}
return ret
}

View File

@ -74,8 +74,3 @@ func (ixn *Intention) FillPartitionAndNamespace(entMeta *EnterpriseMeta, fillDef
ixn.SourcePartition = ""
ixn.DestinationPartition = ""
}
func (ixn *Intention) NormalizePartitionFields() {
ixn.SourcePartition = ""
ixn.DestinationPartition = ""
}

View File

@ -15,6 +15,6 @@ func TestIntention(t testing.T) *Intention {
SourceType: IntentionSourceConsul,
Meta: map[string]string{},
}
ixn.NormalizePartitionFields()
ixn.FillPartitionAndNamespace(nil, true)
return ixn
}