github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/orderer/consensus/inactive/inactive_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 inactive_test
     8  
     9  import (
    10  	"github.com/osdi23p228/fabric/orderer/common/types"
    11  	"testing"
    12  
    13  	"github.com/osdi23p228/fabric/orderer/consensus/inactive"
    14  	"github.com/pkg/errors"
    15  	"github.com/stretchr/testify/assert"
    16  )
    17  
    18  func TestInactiveChain(t *testing.T) {
    19  	err := errors.New("foo")
    20  	chain := &inactive.Chain{Err: err}
    21  
    22  	assert.Equal(t, err, chain.Order(nil, 0))
    23  	assert.Equal(t, err, chain.Configure(nil, 0))
    24  	assert.Equal(t, err, chain.WaitReady())
    25  	assert.NotPanics(t, chain.Start)
    26  	assert.NotPanics(t, chain.Halt)
    27  	_, open := <-chain.Errored()
    28  	assert.False(t, open)
    29  
    30  	cRel, status := chain.StatusReport()
    31  	assert.Equal(t, types.ClusterRelationConfigTracker, cRel)
    32  	assert.Equal(t, types.StatusInactive, status)
    33  }