Skip to content

Commit

Permalink
itest: add universe RPC harness and utilise for basic send
Browse files Browse the repository at this point in the history
  • Loading branch information
ffranr committed Sep 7, 2023
1 parent 511e4a6 commit 33718d4
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
7 changes: 7 additions & 0 deletions itest/tapd_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ func newTapdHarness(ht *harnessTest, cfg tapdConfig,
ReceiverAckTimeout: receiverAckTimeout,
BackoffCfg: backoffCfg,
}

case *UniverseRPCHarness:
finalCfg.DefaultProofCourierAddr = fmt.Sprintf(
"%s://%s", proof.UniverseRpcCourierType,
typedProofCourier.ListenAddr,
)

default:
finalCfg.DefaultProofCourierAddr = ""
finalCfg.HashMailCourier = nil
Expand Down
3 changes: 3 additions & 0 deletions itest/test_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ func setupHarnesses(t *testing.T, ht *harnessTest,
port := nextAvailablePort()
apHarness := NewApertureHarness(ht.t, port)
proofCourier = &apHarness

case proof.UniverseRpcCourierType:
proofCourier = NewUniverseRPCHarness(t, ht, lndHarness.Bob)
}

// Start the proof courier harness if specified.
Expand Down
5 changes: 5 additions & 0 deletions itest/test_list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ var testCases = []*testCase{
test: testBasicSendUnidirectional,
proofCourierType: proof.ApertureCourier,
},
{
name: "basic send universerpc proof courier",
test: testBasicSendUnidirectional,
proofCourierType: proof.UniverseRpcCourierType,
},
{
name: "resume pending package send",
test: testResumePendingPackageSend,
Expand Down
51 changes: 51 additions & 0 deletions itest/universerpc_harness.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package itest

import (
"testing"

"github.com/lightninglabs/taproot-assets/proof"
"github.com/lightningnetwork/lnd/lntest/node"
"github.com/stretchr/testify/require"
)

// UniverseRPCHarness is an integration testing harness for the universe tap
// service.
type UniverseRPCHarness struct {
// service is the instance of the universe tap service.
service *tapdHarness

// ListenAddr is the address that the service is listening on.
ListenAddr string
}

// NewUniverseRPCHarness creates a new test harness for a universe tap service.
func NewUniverseRPCHarness(t *testing.T, ht *harnessTest,
lndHarness *node.HarnessNode) *UniverseRPCHarness {

service, err := newTapdHarness(
ht, tapdConfig{
NetParams: harnessNetParams,
LndNode: lndHarness,
}, nil, nil, nil,
)
require.NoError(t, err)

return &UniverseRPCHarness{
service: service,
ListenAddr: service.rpcHost(),
}
}

// Start starts the service.
func (h *UniverseRPCHarness) Start(_ chan error) error {
return h.service.start(false)
}

// Stop stops the service.
func (h *UniverseRPCHarness) Stop() error {
return h.service.stop(true)
}

// Ensure that NewUniverseRPCHarness implements the proof.CourierHarness
// interface.
var _ proof.CourierHarness = (*UniverseRPCHarness)(nil)

0 comments on commit 33718d4

Please sign in to comment.