github.com/lzy4123/fabric@v2.1.1+incompatible/integration/sbe/sbe_suite_test.go (about)

     1  /*
     2  Copyright IBM Corp All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package sbe
     8  
     9  import (
    10  	"encoding/json"
    11  	"testing"
    12  
    13  	"github.com/hyperledger/fabric/integration"
    14  	"github.com/hyperledger/fabric/integration/nwo"
    15  	. "github.com/onsi/ginkgo"
    16  	. "github.com/onsi/gomega"
    17  )
    18  
    19  func TestEndToEnd(t *testing.T) {
    20  	RegisterFailHandler(Fail)
    21  	RunSpecs(t, "State-Based Endorsement EndToEnd Suite")
    22  }
    23  
    24  var (
    25  	buildServer *nwo.BuildServer
    26  	components  *nwo.Components
    27  )
    28  
    29  var _ = SynchronizedBeforeSuite(func() []byte {
    30  	nwo.RequiredImages = []string{nwo.CCEnvDefaultImage}
    31  
    32  	buildServer = nwo.NewBuildServer()
    33  	buildServer.Serve()
    34  
    35  	components = buildServer.Components()
    36  	payload, err := json.Marshal(components)
    37  	Expect(err).NotTo(HaveOccurred())
    38  
    39  	return payload
    40  }, func(payload []byte) {
    41  	err := json.Unmarshal(payload, &components)
    42  	Expect(err).NotTo(HaveOccurred())
    43  })
    44  
    45  var _ = SynchronizedAfterSuite(func() {
    46  }, func() {
    47  	buildServer.Shutdown()
    48  })
    49  
    50  func StartPort() int {
    51  	return integration.SBEBasePort.StartPortForNode()
    52  }