github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/offering/base/console/override/deployerservice_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 override_test 20 21 import ( 22 . "github.com/onsi/ginkgo/v2" 23 . "github.com/onsi/gomega" 24 corev1 "k8s.io/api/core/v1" 25 26 current "github.com/IBM-Blockchain/fabric-operator/api/v1beta1" 27 consolev1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/console/v1" 28 "github.com/IBM-Blockchain/fabric-operator/pkg/manager/resources" 29 "github.com/IBM-Blockchain/fabric-operator/pkg/offering/base/console/override" 30 "github.com/IBM-Blockchain/fabric-operator/pkg/util" 31 ) 32 33 var _ = Describe("Base Console Deployer Service Overrides", func() { 34 var ( 35 overrider *override.Override 36 instance *current.IBPConsole 37 service *corev1.Service 38 ) 39 40 BeforeEach(func() { 41 var err error 42 43 service, err = util.GetServiceFromFile("../../../../../definitions/console/deployer-service.yaml") 44 Expect(err).NotTo(HaveOccurred()) 45 46 overrider = &override.Override{} 47 instance = ¤t.IBPConsole{ 48 Spec: current.IBPConsoleSpec{ 49 Service: ¤t.Service{ 50 Type: corev1.ServiceTypeNodePort, 51 }, 52 NetworkInfo: ¤t.NetworkInfo{ 53 ConsolePort: 1234, 54 }, 55 }, 56 } 57 }) 58 59 Context("create", func() { 60 It("overrides values based on spec with devmode on", func() { 61 instance.Spec.FeatureFlags = &consolev1.FeatureFlags{ 62 DevMode: true, 63 } 64 65 err := overrider.DeployerService(instance, service, resources.Create) 66 Expect(err).NotTo(HaveOccurred()) 67 68 By("setting service type", func() { 69 Expect(service.Spec.Type).To(Equal(instance.Spec.Service.Type)) 70 }) 71 }) 72 73 }) 74 })