File tree Expand file tree Collapse file tree 3 files changed +54
-5
lines changed
.openshift-tests-extension
cmd/cluster-version-operator-tests Expand file tree Collapse file tree 3 files changed +54
-5
lines changed Original file line number Diff line number Diff line change 11[
22 {
3- "name" : " [Jira:\" Cluster Version Operator\" ] cluster-version-operator-tests should support passing tests" ,
3+ "name" : " [Jira:\" Cluster Version Operator\" ] cluster-version-operator-tests should support passing tests the sanity test should pass " ,
44 "labels" : {},
55 "resources" : {
66 "isolation" : {}
Original file line number Diff line number Diff line change @@ -4,16 +4,28 @@ It integrates [openshift-tests-extension](https://github.com/openshift-eng/opens
44cluster-version-operator which allows openshift components to contribute tests to openshift-tests' suites with
55extension binaries.
66
7+ ## Build the executable binary
8+ In root folder, run below command to build executable binary:
9+ ``` console
10+ $ make build
11+ ```
712
813## Run the tests locally
914
10- ## Using the framework
15+ ### Using the binary
16+ - run a test-suite
17+ ``` console
18+ $ _output/< OS> /< ARCH> /cluster-version-operator-tests run-suite < test suite name>
19+ ```
20+ where test suites can be listed by ` _output/<OS>/<ARCH>/cluster-version-operator-tests info ` .
21+
22+ - run a single test case
1123``` console
12- $ hack/build-go.sh
13- $ _output/< OS> /< ARCH> /cluster-version-operator-tests run-suite cluster-version-operator
24+ $ _output/< OS> /< ARCH> /cluster-version-operator-tests run-test < test case name>
1425```
26+ where test names can be listed by ` _output/<OS>/<ARCH>/cluster-version-operator-tests list ` .
1527
16- ## Using ginko-cli
28+ ### Using ginko-cli
1729
1830After [ installing-ginkgo] ( https://onsi.github.io/ginkgo/#installing-ginkgo ) :
1931
Original file line number Diff line number Diff line change 1+ package utilities
2+
3+ import (
4+ "errors"
5+ "fmt"
6+ "os"
7+
8+ "k8s.io/client-go/kubernetes"
9+ "k8s.io/client-go/tools/clientcmd"
10+ )
11+
12+ // getKubeClient creates a Kubernetes clientset.
13+ func getKubeClient () (* kubernetes.Clientset , error ) {
14+ configPath , present := os .LookupEnv ("KUBECONFIG" )
15+ if ! present {
16+ return nil , errors .New ("the environment variable KUBECONFIG must be set" )
17+ }
18+ config , err := clientcmd .BuildConfigFromFlags ("" , configPath )
19+ if err != nil {
20+ return nil , fmt .Errorf ("unable to load build config: %w" , err )
21+ }
22+ // Create the Clientset
23+ clientset , err := kubernetes .NewForConfig (config )
24+ if err != nil {
25+ return nil , fmt .Errorf ("unable to create a Kubernetes clientset: %w" , err )
26+ }
27+ return clientset , nil
28+ }
29+
30+ // MustGetKubeClient creates a Kubernetes clientset, or panics on failures.
31+ func MustGetKubeClient () * kubernetes.Clientset {
32+ clientset , err := getKubeClient ()
33+ if err != nil {
34+ panic ("unable to create a Kubernetes clientset: " + err .Error ())
35+ }
36+ return clientset
37+ }
You can’t perform that action at this time.
0 commit comments