2017-10-17 22:50:27 +00:00
/ *
Copyright 2016 The Kubernetes Authors .
2017-11-05 21:35:46 +00:00
2017-10-17 22:50:27 +00:00
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
2017-11-05 21:35:46 +00:00
2017-10-17 22:50:27 +00:00
http : //www.apache.org/licenses/LICENSE-2.0
2017-11-05 21:35:46 +00:00
2017-10-17 22:50:27 +00:00
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
package framework
import (
"flag"
"github.com/onsi/ginkgo/config"
)
2018-03-07 16:37:30 +00:00
// TestContextType describes the client context to use in communications with the Kubernetes API.
2017-10-17 22:50:27 +00:00
type TestContextType struct {
2019-02-22 14:03:42 +00:00
KubeHost string
//KubeConfig string
2017-10-17 22:50:27 +00:00
KubeContext string
}
2018-03-07 16:37:30 +00:00
// TestContext is the global client context for tests.
2017-10-17 22:50:27 +00:00
var TestContext TestContextType
2020-06-27 15:57:00 +00:00
// registerCommonFlags registers flags common to all e2e test suites.
func registerCommonFlags ( ) {
2017-10-17 22:50:27 +00:00
config . GinkgoConfig . EmitSpecProgress = true
flag . StringVar ( & TestContext . KubeHost , "kubernetes-host" , "http://127.0.0.1:8080" , "The kubernetes host, or apiserver, to connect to" )
2019-02-22 14:03:42 +00:00
//flag.StringVar(&TestContext.KubeConfig, "kubernetes-config", os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to config containing embedded authinfo for kubernetes. Default value is from environment variable "+clientcmd.RecommendedConfigPathEnvVar)
2017-12-02 05:45:56 +00:00
flag . StringVar ( & TestContext . KubeContext , "kubernetes-context" , "" , "config context to use for kubernetes. If unset, will use value from 'current-context'" )
2017-10-17 22:50:27 +00:00
}
2018-03-07 16:37:30 +00:00
// RegisterParseFlags registers and parses flags for the test binary.
2017-10-17 22:50:27 +00:00
func RegisterParseFlags ( ) {
2020-06-27 15:57:00 +00:00
registerCommonFlags ( )
2017-10-17 22:50:27 +00:00
flag . Parse ( )
}