github.com/anjalikarhana/fabric@v2.1.1+incompatible/integration/msp/msp_suite_test.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package msp
     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 TestMSP(t *testing.T) {
    20  	RegisterFailHandler(Fail)
    21  	RunSpecs(t, "MSP 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  	return payload
    37  }, func(payload []byte) {
    38  	err := json.Unmarshal(payload, &components)
    39  	Expect(err).NotTo(HaveOccurred())
    40  })
    41  
    42  var _ = SynchronizedAfterSuite(func() {
    43  }, func() {
    44  	buildServer.Shutdown()
    45  })
    46  
    47  func StartPort() int {
    48  	return integration.MSPPort.StartPortForNode()
    49  }