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 4, 2023
1 parent 65ee400 commit ab506bb
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
8 changes: 8 additions & 0 deletions itest/tapd_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ func newTapdHarness(ht *harnessTest, cfg tapdConfig,
ReceiverAckTimeout: receiverAckTimeout,
BackoffCfg: backoffCfg,
}

case *UniverseRPCHarness:
finalCfg.HashMailCourier = nil
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
50 changes: 50 additions & 0 deletions itest/universerpc_harness.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package itest

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

// 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 ab506bb

Please sign in to comment.