Skip to content

Commit d8ccc92

Browse files
committed
itest: separate tapd logs from itest
1 parent c2b0a37 commit d8ccc92

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

itest/assertions.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,11 +1275,6 @@ func AssertAssetOutboundTransferWithOutputs(t *testing.T,
12751275
outpoints[o.Anchor.Outpoint] = struct{}{}
12761276
scripts[string(o.ScriptKey)] = struct{}{}
12771277
}
1278-
1279-
sendRespJSON, err := formatProtoJSON(transfer)
1280-
require.NoError(t, err)
1281-
t.Logf("Got response from sending assets: %v", sendRespJSON)
1282-
12831278
// Mine a block to force the send event to complete (confirm on-chain).
12841279
var newBlock *wire.MsgBlock
12851280
if confirm {
@@ -1318,23 +1313,11 @@ func AssertAssetOutboundTransferWithOutputs(t *testing.T,
13181313
inputAssetIDs, hex.EncodeToString,
13191314
)
13201315

1321-
t.Logf("Want input asset IDs: %v, got: %v",
1322-
expectedInputAssetIDs, actualInputAssetIDs)
13231316
return fn.All(
13241317
expectedInputAssetIDs, func(id string) bool {
13251318
return slices.Contains(actualInputAssetIDs, id)
13261319
})
13271320
}, defaultTimeout, wait.PollInterval)
1328-
require.NoError(t, err)
1329-
1330-
transferResp, err := sender.ListTransfers(
1331-
ctxb, &taprpc.ListTransfersRequest{},
1332-
)
1333-
require.NoError(t, err)
1334-
1335-
transferRespJSON, err := formatProtoJSON(transferResp)
1336-
require.NoError(t, err)
1337-
t.Logf("Got response from list transfers: %v", transferRespJSON)
13381321

13391322
return newBlock
13401323
}

itest/tapd_harness.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func newTapdHarness(t *testing.T, ht *harnessTest, cfg tapdConfig,
190190
}
191191

192192
tapCfg := tapcfg.DefaultConfig()
193-
tapCfg.LogDir = "."
193+
tapCfg.LogDir = *logDir
194194
tapCfg.MaxLogFiles = 99
195195
tapCfg.MaxLogFileSize = 999
196196

itest/test_harness.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"flag"
66
"fmt"
7+
"path/filepath"
78
"testing"
89
"time"
910

@@ -45,8 +46,12 @@ var (
4546

4647
// logLevel is a command line flag for setting the log level of the
4748
// integration test output.
48-
logLevel = flag.String("loglevel", "info", "Set the log level of the "+
49+
logLevel = flag.String("loglevel", "debug", "Set the log level of the "+
4950
"integration test output")
51+
52+
// logDir is the directory for tapd and test logs.
53+
// We hardcode this to match the Makefile's -logdir=regtest flag.
54+
logDir = &[]string{"regtest"}[0]
5055
)
5156

5257
const (
@@ -201,12 +206,18 @@ func (h *harnessTest) shutdown(_ *testing.T) error {
201206
func (h *harnessTest) setupLogging() {
202207
h.logWriter = build.NewRotatingLogWriter()
203208

209+
// Initialize the log rotator with a file in the log directory.
204210
logConfig := build.DefaultLogConfig()
211+
// Disable console logging to avoid mixing with test output
212+
logConfig.Console.Disable = true
213+
logFile := filepath.Join(*logDir, "tapd.log")
214+
err := h.logWriter.InitLogRotator(logConfig.File, logFile)
215+
require.NoError(h.t, err)
216+
205217
h.logMgr = build.NewSubLoggerManager(
206218
build.NewDefaultLogHandlers(logConfig, h.logWriter)...,
207219
)
208220

209-
var err error
210221
h.interceptor, err = signal.Intercept()
211222
require.NoError(h.t, err)
212223

itest/test_list_on_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ var allTestCases = []*testCase{
101101
name: "min relay fee bump",
102102
test: testMinRelayFeeBump,
103103
},
104+
{
105+
name: "zero value anchor sweep",
106+
test: testZeroValueAnchorSweep,
107+
},
104108
{
105109
name: "restart receiver check balance",
106110
test: testRestartReceiverCheckBalance,

0 commit comments

Comments
 (0)