fix: Ensure changes in MatchCN annotation are detected (#11173)

This commit is contained in:
wdullaer 2024-07-02 05:48:24 +09:00 committed by GitHub
parent 6a111a974b
commit bcb98c0c8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 0 deletions

View file

@ -122,6 +122,9 @@ func (assl1 *Config) Equal(assl2 *Config) bool {
if assl1.PassCertToUpstream != assl2.PassCertToUpstream {
return false
}
if assl1.MatchCN != assl2.MatchCN {
return false
}
return true
}

View file

@ -333,6 +333,15 @@ func TestEquals(t *testing.T) {
}
cfg2.PassCertToUpstream = true
// Different MatchCN
cfg1.MatchCN = "CN=(hello-app|goodbye)"
cfg2.MatchCN = "CN=(hello-app)"
result = cfg1.Equal(cfg2)
if result != false {
t.Errorf("Expected false")
}
cfg2.MatchCN = "CN=(hello-app|goodbye)"
// Equal Configs
result = cfg1.Equal(cfg2)
if result != true {