github.com/IBM-Blockchain/fabric-operator@v1.0.4/integration/e2ev2/ca_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 e2ev2_test 20 21 import ( 22 . "github.com/onsi/ginkgo/v2" 23 . "github.com/onsi/gomega" 24 25 current "github.com/IBM-Blockchain/fabric-operator/api/v1beta1" 26 "github.com/IBM-Blockchain/fabric-operator/integration" 27 "github.com/IBM-Blockchain/fabric-operator/integration/helper" 28 ) 29 30 const ( 31 IBPCAS = "ibpcas" 32 ) 33 34 var ( 35 org1ca *helper.CA 36 ) 37 38 var _ = Describe("ca", func() { 39 BeforeEach(func() { 40 Eventually(org1ca.PodIsRunning).Should((Equal(true))) 41 42 ClearOperatorConfig() 43 }) 44 45 AfterEach(func() { 46 // Set flag if a test falls 47 if CurrentGinkgoTestDescription().Failed { 48 testFailed = true 49 } 50 }) 51 52 // Marked as Pending because slow clusters makes this test flaky as the CR 53 // doesn't get created, so there is a small window of time to catch 54 // its error status before it disappears. 55 PContext("validate CR name when created", func() { 56 BeforeEach(func() { 57 Eventually(org1peer.PodIsRunning).Should((Equal(true))) 58 }) 59 60 When("creating a CA with a pre-existing CR name", func() { 61 It("puts CA in error phase", func() { 62 org1ca2 := Org1CA2() 63 helper.CreateCA(ibpCRClient, org1ca2.CR) 64 65 Eventually(org1ca2.PollForCRStatus).Should((Equal(current.Error))) 66 }) 67 }) 68 }) 69 }) 70 71 func Org1CA2() *helper.CA { 72 cr := helper.Org1CACR(namespace, domain) 73 // Set CR name to existing cr name for test 74 cr.Name = "org1peer" 75 76 return &helper.CA{ 77 Domain: domain, 78 Name: cr.Name, 79 Namespace: namespace, 80 WorkingDir: wd, 81 CR: cr, 82 CRClient: ibpCRClient, 83 KClient: kclient, 84 NativeResourcePoller: integration.NativeResourcePoller{ 85 Name: cr.Name, 86 Namespace: namespace, 87 Client: kclient, 88 }, 89 } 90 }