sigs.k8s.io/kueue@v0.6.2/test/e2e/singlecluster/suite_test.go (about) 1 /* 2 Copyright 2022 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 e2e 18 19 import ( 20 "context" 21 "fmt" 22 "os" 23 "testing" 24 "time" 25 26 "github.com/onsi/ginkgo/v2" 27 "github.com/onsi/gomega" 28 "sigs.k8s.io/controller-runtime/pkg/client" 29 30 visibilityv1alpha1 "sigs.k8s.io/kueue/client-go/clientset/versioned/typed/visibility/v1alpha1" 31 "sigs.k8s.io/kueue/test/util" 32 // +kubebuilder:scaffold:imports 33 ) 34 35 var ( 36 k8sClient client.WithWatch 37 ctx context.Context 38 visibilityClient visibilityv1alpha1.VisibilityV1alpha1Interface 39 impersonatedVisibilityClient visibilityv1alpha1.VisibilityV1alpha1Interface 40 ) 41 42 func TestAPIs(t *testing.T) { 43 suiteName := "End To End Suite" 44 if ver, found := os.LookupEnv("E2E_KIND_VERSION"); found { 45 suiteName = fmt.Sprintf("%s: %s", suiteName, ver) 46 } 47 gomega.RegisterFailHandler(ginkgo.Fail) 48 ginkgo.RunSpecs(t, 49 suiteName, 50 ) 51 } 52 53 var _ = ginkgo.BeforeSuite(func() { 54 k8sClient = util.CreateClientUsingCluster("") 55 visibilityClient = util.CreateVisibilityClient("") 56 impersonatedVisibilityClient = util.CreateVisibilityClient("system:serviceaccount:kueue-system:default") 57 ctx = context.Background() 58 59 waitForAvailableStart := time.Now() 60 util.WaitForKueueAvailability(ctx, k8sClient) 61 ginkgo.GinkgoLogr.Info("Kueue is Available in the cluster", "waitingTime", time.Since(waitForAvailableStart)) 62 })