-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2043 from kcalvinalvin/2023-10-12-add-integration…
…-test-for-prune integration: add test to check prune status
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2023 The btcsuite developers | ||
// Use of this source code is governed by an ISC | ||
// license that can be found in the LICENSE file. | ||
|
||
// This file is ignored during the regular tests due to the following build tag. | ||
//go:build rpctest | ||
// +build rpctest | ||
|
||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/btcsuite/btcd/chaincfg" | ||
"github.com/btcsuite/btcd/integration/rpctest" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPrune(t *testing.T) { | ||
t.Parallel() | ||
|
||
// Boilerplate code to make a pruned node. | ||
btcdCfg := []string{"--prune=1536"} | ||
r, err := rpctest.New(&chaincfg.SimNetParams, nil, btcdCfg, "") | ||
require.NoError(t, err) | ||
|
||
if err := r.SetUp(false, 0); err != nil { | ||
require.NoError(t, err) | ||
} | ||
t.Cleanup(func() { r.TearDown() }) | ||
|
||
// Check that the rpc call for block chain info comes back correctly. | ||
chainInfo, err := r.Client.GetBlockChainInfo() | ||
require.NoError(t, err) | ||
|
||
if !chainInfo.Pruned { | ||
t.Fatalf("expected the node to be pruned but the pruned "+ | ||
"boolean was %v", chainInfo.Pruned) | ||
} | ||
} |