Revision 9368f21c53b7aa96b8743a0b8b79a0ab44d963c6 authored by Jarno Rajahalme on 20 June 2024, 21:26:05 UTC, committed by Nathan Sweet on 21 June 2024, 15:57:37 UTC
AllowsIdentity is only used for testing, move it there. Add the missing InvertedPortMask field on the wildcard port lookup. Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
1 parent d97069c
test_utils.go
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package endpoint
import (
"github.com/cilium/cilium/pkg/identity"
"github.com/cilium/cilium/pkg/time"
)
// WaitForIdentity waits for up to timeoutDuration amount of time for the
// endpoint to have an identity. If the timeout is reached, returns nil.
func (e *Endpoint) WaitForIdentity(timeoutDuration time.Duration) *identity.Identity {
timeout := time.NewTimer(timeoutDuration)
defer timeout.Stop()
tick := time.NewTicker(200 * time.Millisecond)
defer tick.Stop()
var secID *identity.Identity
for {
select {
case <-timeout.C:
return nil
case <-tick.C:
e.unconditionalRLock()
secID = e.SecurityIdentity
e.runlock()
if secID != nil {
return secID
}
}
}
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...