github.com/openshift-online/ocm-sdk-go@v0.1.473/retry/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 retry 18 19 import ( 20 "log" 21 "testing" 22 23 "github.com/openshift-online/ocm-sdk-go/logging" 24 25 . "github.com/onsi/ginkgo/v2/dsl/core" // nolint 26 . "github.com/onsi/gomega" // nolint 27 ) 28 29 func TestRetry(t *testing.T) { 30 RegisterFailHandler(Fail) 31 RunSpecs(t, "Retry") 32 } 33 34 // Logger used for tests: 35 var logger logging.Logger 36 37 var _ = BeforeSuite(func() { 38 var err error 39 40 // Create the logger that will be used by all the tests: 41 logger, err = logging.NewStdLoggerBuilder(). 42 Streams(GinkgoWriter, GinkgoWriter). 43 Debug(true). 44 Build() 45 Expect(err).ToNot(HaveOccurred()) 46 47 // Redirect standard logging to the Ginkgo writer so that error messages generated by the 48 // HTTP clients (for example when a protocol error happens) will not interfere with the 49 // Ginkgo output: 50 log.SetOutput(GinkgoWriter) 51 })