github.com/btcsuite/btcd@v0.24.0/integration/prune_test.go (about) 1 // Copyright (c) 2023 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 // This file is ignored during the regular tests due to the following build tag. 6 //go:build rpctest 7 // +build rpctest 8 9 package integration 10 11 import ( 12 "testing" 13 14 "github.com/btcsuite/btcd/chaincfg" 15 "github.com/btcsuite/btcd/integration/rpctest" 16 "github.com/stretchr/testify/require" 17 ) 18 19 func TestPrune(t *testing.T) { 20 t.Parallel() 21 22 // Boilerplate code to make a pruned node. 23 btcdCfg := []string{"--prune=1536"} 24 r, err := rpctest.New(&chaincfg.SimNetParams, nil, btcdCfg, "") 25 require.NoError(t, err) 26 27 if err := r.SetUp(false, 0); err != nil { 28 require.NoError(t, err) 29 } 30 t.Cleanup(func() { r.TearDown() }) 31 32 // Check that the rpc call for block chain info comes back correctly. 33 chainInfo, err := r.Client.GetBlockChainInfo() 34 require.NoError(t, err) 35 36 if !chainInfo.Pruned { 37 t.Fatalf("expected the node to be pruned but the pruned "+ 38 "boolean was %v", chainInfo.Pruned) 39 } 40 }