github.com/turingchain2020/turingchain@v1.1.21/blockchain/ntp_test.go (about)

     1  package blockchain
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/turingchain2020/turingchain/queue"
     7  	"github.com/turingchain2020/turingchain/types"
     8  )
     9  
    10  func TestCheckClockDrift(t *testing.T) {
    11  	cfg := types.NewTuringchainConfig(types.GetDefaultCfgstring())
    12  	q := queue.New("channel")
    13  	q.SetConfig(cfg)
    14  
    15  	blockchain := &BlockChain{}
    16  	blockchain.client = q.Client()
    17  	blockchain.checkClockDrift()
    18  
    19  	cfg.GetModuleConfig().NtpHosts = append(cfg.GetModuleConfig().NtpHosts, types.NtpHosts...)
    20  	blockchain.checkClockDrift()
    21  }