mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-27 09:15:22 -04:00
AB#1903 Push keys to restarting nodes on trigger RPC
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
152e3985f7
commit
37aff14cab
9 changed files with 193 additions and 24 deletions
|
@ -1,9 +1,13 @@
|
|||
package pubapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/goleak"
|
||||
grpcpeer "google.golang.org/grpc/peer"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@ -14,3 +18,20 @@ func TestMain(m *testing.M) {
|
|||
goleak.IgnoreTopFunction("k8s.io/klog/v2.(*loggingT).flushDaemon"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestGetRecoveryPeerFromContext(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
testIP := "192.0.2.1"
|
||||
testPort := 1234
|
||||
expectedPeer := net.JoinHostPort(testIP, "9000")
|
||||
|
||||
addr := &net.TCPAddr{IP: net.ParseIP(testIP), Port: testPort}
|
||||
ctx := grpcpeer.NewContext(context.Background(), &grpcpeer.Peer{Addr: addr})
|
||||
|
||||
peer, err := GetRecoveryPeerFromContext(ctx)
|
||||
assert.NoError(err)
|
||||
assert.Equal(expectedPeer, peer)
|
||||
|
||||
_, err = GetRecoveryPeerFromContext(context.Background())
|
||||
assert.Error(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue