github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/initializer/orderer/configtx/configtx_test.go (about)

     1  /*
     2   * Copyright contributors to the Hyperledger Fabric Operator project
     3   *
     4   * SPDX-License-Identifier: Apache-2.0
     5   *
     6   * Licensed under the Apache License, Version 2.0 (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at:
     9   *
    10   * 	  http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an "AS IS" BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  package configtx_test
    20  
    21  import (
    22  	"github.com/IBM-Blockchain/fabric-operator/pkg/initializer/orderer/configtx"
    23  	. "github.com/onsi/ginkgo/v2"
    24  	. "github.com/onsi/gomega"
    25  )
    26  
    27  const (
    28  	defaultConfigTxFile = "../../../../testdata/init/orderer/configtx.yaml"
    29  	defaultConfigTxDir  = "../../../../testdata/init/orderer"
    30  )
    31  
    32  var _ = Describe("configtx", func() {
    33  	var (
    34  		err      error
    35  		configTx *configtx.ConfigTx
    36  	)
    37  
    38  	BeforeEach(func() {
    39  		configTx = configtx.New()
    40  	})
    41  
    42  	It("returns an error if profile does not exist", func() {
    43  		_, err = configTx.GetProfile("badprofile")
    44  		Expect(err).To(HaveOccurred())
    45  		Expect(err.Error()).To(Equal("profile 'badprofile' does not exist"))
    46  	})
    47  
    48  	It("loads top level config from file", func() {
    49  		config, err := configtx.LoadTopLevelConfig(defaultConfigTxFile)
    50  		Expect(err).NotTo(HaveOccurred())
    51  		Expect(config).NotTo(BeNil())
    52  	})
    53  })