github.com/sykesm/fabric@v1.1.0-preview.0.20200129034918-2aa12b1a0181/integration/pvtdata/pvtdata_suite_test.go (about)

     1  /*
     2  Copyright IBM Corp All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package pvtdata
     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, "Private Data Suite")
    22  }
    23  
    24  var (
    25  	buildServer *nwo.BuildServer
    26  	components  *nwo.Components
    27  )
    28  
    29  var _ = SynchronizedBeforeSuite(func() []byte {
    30  	buildServer = nwo.NewBuildServer()
    31  	buildServer.Serve()
    32  
    33  	components = buildServer.Components()
    34  	payload, err := json.Marshal(components)
    35  	Expect(err).NotTo(HaveOccurred())
    36  
    37  	return payload
    38  }, func(payload []byte) {
    39  	err := json.Unmarshal(payload, &components)
    40  	Expect(err).NotTo(HaveOccurred())
    41  })
    42  
    43  var _ = SynchronizedAfterSuite(func() {
    44  }, func() {
    45  	buildServer.Shutdown()
    46  })
    47  
    48  func StartPort() int {
    49  	return integration.PrivateDataBasePort.StartPortForNode()
    50  }