test fixes

This commit is contained in:
Gareth George
2026-05-02 23:19:33 -07:00
parent 9f5c75431d
commit e7e46772ba
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -136,13 +136,13 @@ func establishEncryption(stream syncCommandStreamTrait) (syncCommandStreamTrait,
},
},
}); err != nil {
return nil, NewSyncErrorProtocol(fmt.Errorf("sending ECDH public key: %w", err))
return nil, NewSyncErrorDisconnected(fmt.Errorf("sending ECDH public key: %w", err))
}
// Receive the peer's ephemeral ECDH public key
peerMsg, err := stream.Receive()
if err != nil {
return nil, NewSyncErrorProtocol(fmt.Errorf("receiving ECDH public key: %w", err))
return nil, NewSyncErrorDisconnected(fmt.Errorf("receiving ECDH public key: %w", err))
}
peerSecret := peerMsg.GetEstablishSharedSecret()
if peerSecret == nil {
+2
View File
@@ -6,6 +6,7 @@ import (
"github.com/garethgeorge/backrest/gen/go/v1sync"
"github.com/garethgeorge/backrest/internal/cryptoutil"
"github.com/garethgeorge/backrest/internal/testutil"
)
// fakeStream is a pair of in-memory channels simulating a bidirectional transport.
@@ -135,6 +136,7 @@ func TestEncryptedStream_BidirectionalMultiMessage(t *testing.T) {
}
func TestEstablishEncryption_Integration(t *testing.T) {
testutil.InstallZapLogger(t)
transportA, transportB := newFakeStreamPair()
var encA, encB syncCommandStreamTrait
+3 -3
View File
@@ -74,7 +74,7 @@ var (
func TestConnectionSucceeds(t *testing.T) {
testutil.InstallZapLogger(t)
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
peerHostAddr := testutil.AllocOpenBindAddr(t)
peerClientAddr := testutil.AllocOpenBindAddr(t)
@@ -121,7 +121,7 @@ func TestConnectionSucceeds(t *testing.T) {
func TestConnectionBadKeyRejected(t *testing.T) {
testutil.InstallZapLogger(t)
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
peerHostAddr := testutil.AllocOpenBindAddr(t)
peerClientAddr := testutil.AllocOpenBindAddr(t)
@@ -270,7 +270,7 @@ func TestSyncConfigChange(t *testing.T) {
func TestSimpleOperationSync(t *testing.T) {
testutil.InstallZapLogger(t)
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
peerHostAddr := testutil.AllocOpenBindAddr(t)
peerClientAddr := testutil.AllocOpenBindAddr(t)