github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/orderer/consensus/follower/follower_chain_test.go (about)

     1  /*
     2  Copyright IBM Corp. 2017 All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package follower_test
     8  
     9  import (
    10  	"github.com/osdi23p228/fabric/orderer/common/types"
    11  	"testing"
    12  
    13  	"github.com/osdi23p228/fabric/orderer/consensus/follower"
    14  	"github.com/pkg/errors"
    15  	"github.com/stretchr/testify/assert"
    16  )
    17  
    18  //TODO skeleton
    19  
    20  func TestFollowerChain(t *testing.T) {
    21  	err := errors.New("bar")
    22  	chain := &follower.Chain{Err: err}
    23  
    24  	assert.Equal(t, err, chain.Order(nil, 0))
    25  	assert.Equal(t, err, chain.Configure(nil, 0))
    26  	assert.Equal(t, err, chain.WaitReady())
    27  	assert.NotPanics(t, chain.Start)
    28  	assert.NotPanics(t, chain.Halt)
    29  	_, open := <-chain.Errored()
    30  	assert.False(t, open)
    31  
    32  	cRel, status := chain.StatusReport()
    33  	assert.Equal(t, types.ClusterRelationFollower, cRel)
    34  	assert.True(t, status == types.StatusActive || status == types.StatusOnBoarding)
    35  }