mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-14 19:00:50 +01:00
01e7caf640
Support route53 for TLS handling
41 lines
774 B
Go
41 lines
774 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"go.opentelemetry.io/otel"
|
|
|
|
"github.com/netbirdio/netbird/relay/metrics"
|
|
)
|
|
|
|
func TestStore_DeletePeer(t *testing.T) {
|
|
s := NewStore()
|
|
|
|
m, _ := metrics.NewMetrics(context.Background(), otel.Meter(""))
|
|
|
|
p := NewPeer(m, []byte("peer_one"), nil, nil)
|
|
s.AddPeer(p)
|
|
s.DeletePeer(p)
|
|
if _, ok := s.Peer(p.String()); ok {
|
|
t.Errorf("peer was not deleted")
|
|
}
|
|
}
|
|
|
|
func TestStore_DeleteDeprecatedPeer(t *testing.T) {
|
|
s := NewStore()
|
|
|
|
m, _ := metrics.NewMetrics(context.Background(), otel.Meter(""))
|
|
|
|
p1 := NewPeer(m, []byte("peer_id"), nil, nil)
|
|
p2 := NewPeer(m, []byte("peer_id"), nil, nil)
|
|
|
|
s.AddPeer(p1)
|
|
s.AddPeer(p2)
|
|
s.DeletePeer(p1)
|
|
|
|
if _, ok := s.Peer(p2.String()); !ok {
|
|
t.Errorf("second peer was deleted")
|
|
}
|
|
}
|