github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/wrapper/wrapper_suite_test.go (about)

     1  package wrapper_test
     2  
     3  import (
     4  	"bytes"
     5  	"crypto/rand"
     6  	"crypto/rsa"
     7  	"log"
     8  	"testing"
     9  
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  	. "github.com/onsi/gomega/ghttp"
    13  )
    14  
    15  func TestCloudcontroller(t *testing.T) {
    16  	RegisterFailHandler(Fail)
    17  	RunSpecs(t, "Cloud Controller Wrapper Suite")
    18  }
    19  
    20  var (
    21  	server  *Server
    22  	keyPair *rsa.PrivateKey
    23  )
    24  
    25  var _ = SynchronizedBeforeSuite(func() []byte {
    26  	return []byte{}
    27  }, func(data []byte) {
    28  	server = NewTLSServer()
    29  
    30  	// Suppresses ginkgo server logs
    31  	server.HTTPTestServer.Config.ErrorLog = log.New(&bytes.Buffer{}, "", 0)
    32  
    33  	var err error
    34  	keyPair, err = rsa.GenerateKey(rand.Reader, 2048)
    35  	Expect(err).NotTo(HaveOccurred())
    36  })
    37  
    38  var _ = SynchronizedAfterSuite(func() {
    39  	server.Close()
    40  }, func() {})
    41  
    42  var _ = BeforeEach(func() {
    43  	server.Reset()
    44  })