// BeforeEach gets a client and makes a namespace.
BeforeEach gets a client and makes a namespace.
// BeforeEach gets a client and makes a namespace .
func (f *Framework) BeforeEach() {
	f.cleanupHandle = AddCleanupAction(f.AfterEach)
	f.Timeout = time.Duration(TestContext.TimeoutSeconds) * time.Second
	By("creating a kubernetes client")
	cfg, err := LoadConfig()
	Expect(err).NotTo(HaveOccurred())
	apis.AddToScheme(scheme.Scheme)
	f.Client, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
	Expect(err).NotTo(HaveOccurred())
	f.ClientSet, err = clientset.NewForConfig(cfg)
	Expect(err).NotTo(HaveOccurred())
	if !f.SkipNamespaceCreation {
		namespace, err := f.CreateNamespace(map[string]string{
			"e2e-framework": f.BaseName,
		})
		Expect(err).NotTo(HaveOccurred())
		By(fmt.Sprintf("create a namespace api object (%s)", namespace.Name))
		f.Namespace = namespace
	}
	By("create a orchestrator client")
	f.OrcClient = orc.NewFromURI(fmt.Sprintf(orchestratorURITemplate, OrchestratorPort), 10*time.Second)
}
func ( f * Framework ) BeforeEach ( ) { f . cleanupHandle = AddCleanupAction ( f . AfterEach ) f . Timeout = time . Duration ( TestContext . TimeoutSeconds ) * time . Second By ( " " ) cfg , err := LoadConfig ( ) Expect ( err ) . NotTo ( HaveOccurred ( ) ) apis . AddToScheme ( scheme . Scheme ) f . Client , err = client . New ( cfg , client . Options { Scheme : scheme . Scheme } ) Expect ( err ) . NotTo ( HaveOccurred ( ) ) f . ClientSet , err = clientset . NewForConfig ( cfg ) Expect ( err ) . NotTo ( HaveOccurred ( ) ) if ! f . SkipNamespaceCreation { namespace , err := f . CreateNamespace ( map [ string ] string { " " : f . BaseName , } ) Expect ( err ) . NotTo ( HaveOccurred ( ) ) By ( fmt . Sprintf ( " " , namespace . Name ) ) f . Namespace = namespace } By ( " " ) f . OrcClient = orc . NewFromURI ( fmt . Sprintf ( orchestratorURITemplate , OrchestratorPort ) , 10 * time . Second ) }
BeforeEach gets a client and makes a namespace.
BeforeEach gets a client and makes a namespace .
// The fact that we need this feels like a bug in ginkgo. // https://github.com/onsi/ginkgo/issues/222