github.com/openshift-online/ocm-sdk-go@v0.1.473/leadership/main_test.go (about) 1 /* 2 Copyright (c) 2021 Red Hat, Inc. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package leadership 18 19 import ( 20 "testing" 21 22 "github.com/openshift-online/ocm-sdk-go/logging" 23 24 . "github.com/onsi/ginkgo/v2/dsl/core" // nolint 25 . "github.com/onsi/gomega" // nolint 26 27 . "github.com/openshift-online/ocm-sdk-go/testing" // nolint 28 29 _ "github.com/lib/pq" 30 ) 31 32 func TestLeadership(t *testing.T) { 33 RegisterFailHandler(Fail) 34 RunSpecs(t, "Leadership") 35 } 36 37 // logger is the logger that will be used by the tests. 38 var logger logging.Logger 39 40 // dbServer is the database dbServer that will be used to create the databases used by the tests. 41 var dbServer *DatabaseServer 42 43 var _ = BeforeSuite(func() { 44 var err error 45 46 // Create a logger that writes to the Ginkgo stream: 47 logger, err = logging.NewStdLoggerBuilder(). 48 Streams(GinkgoWriter, GinkgoWriter). 49 Debug(true). 50 Build() 51 Expect(err).ToNot(HaveOccurred()) 52 53 // Start the database server: 54 dbServer = MakeDatabaseServer() 55 }) 56 57 var _ = AfterSuite(func() { 58 // Stop the database server: 59 dbServer.Close() 60 })