|
| 1 | +/* |
| 2 | +Copyright 2018 The Kubernetes Authors. |
| 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 cache_test |
| 18 | + |
| 19 | +import ( |
| 20 | + "testing" |
| 21 | + "time" |
| 22 | + |
| 23 | + logf "github.com/kubernetes-sigs/controller-runtime/pkg/runtime/log" |
| 24 | + "github.com/kubernetes-sigs/controller-runtime/pkg/test" |
| 25 | + . "github.com/onsi/ginkgo" |
| 26 | + . "github.com/onsi/gomega" |
| 27 | + "k8s.io/client-go/kubernetes" |
| 28 | + "k8s.io/client-go/rest" |
| 29 | +) |
| 30 | + |
| 31 | +func TestSource(t *testing.T) { |
| 32 | + RegisterFailHandler(Fail) |
| 33 | + RunSpecsWithDefaultAndCustomReporters(t, "Cache Suite", []Reporter{test.NewlineReporter{}}) |
| 34 | +} |
| 35 | + |
| 36 | +var testenv *test.Environment |
| 37 | +var cfg *rest.Config |
| 38 | +var clientset *kubernetes.Clientset |
| 39 | + |
| 40 | +var _ = BeforeSuite(func(done Done) { |
| 41 | + logf.SetLogger(logf.ZapLogger(false)) |
| 42 | + |
| 43 | + testenv = &test.Environment{} |
| 44 | + |
| 45 | + var err error |
| 46 | + cfg, err = testenv.Start() |
| 47 | + Expect(err).NotTo(HaveOccurred()) |
| 48 | + |
| 49 | + time.Sleep(1 * time.Second) |
| 50 | + |
| 51 | + clientset, err = kubernetes.NewForConfig(cfg) |
| 52 | + Expect(err).NotTo(HaveOccurred()) |
| 53 | + |
| 54 | + close(done) |
| 55 | +}, 60) |
| 56 | + |
| 57 | +var _ = AfterSuite(func() { |
| 58 | + testenv.Stop() |
| 59 | +}) |
0 commit comments