mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-30 18:35:18 +00:00
27 lines
580 B
Go
27 lines
580 B
Go
package noise
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/libp2p/go-libp2p/core/crypto"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestContextCancellationRespected(t *testing.T) {
|
|
initTransport := newTestTransport(t, crypto.Ed25519, 2048)
|
|
respTransport := newTestTransport(t, crypto.Ed25519, 2048)
|
|
|
|
init, resp := newConnPair(t)
|
|
defer init.Close()
|
|
defer resp.Close()
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
cancel()
|
|
|
|
_, err := initTransport.SecureOutbound(ctx, init, respTransport.localID)
|
|
require.Error(t, err)
|
|
require.Equal(t, ctx.Err(), err)
|
|
}
|