Ejemplo n.º 1
0
	var (
		validPluginPath = filepath.Join("..", "fixtures", "plugins", "test_1.exe")
	)

	Describe(".Start", func() {
		It("Exits with status 1 if it cannot ping the host port passed as an argument", func() {
			args := []string{"0", "0"}
			session, err := Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter)
			Expect(err).ToNot(HaveOccurred())
			Eventually(session, 2).Should(Exit(1))
		})

		Context("Executing plugins with '.Start()'", func() {
			var (
				rpcHandlers *fake_rpc_handlers.FakeHandlers
				ts          *test_rpc_server.TestServer
				err         error
			)

			BeforeEach(func() {
				rpcHandlers = &fake_rpc_handlers.FakeHandlers{}
				ts, err = test_rpc_server.NewTestRpcServer(rpcHandlers)
				Expect(err).NotTo(HaveOccurred())

				err = ts.Start()
				Expect(err).NotTo(HaveOccurred())
			})

			AfterEach(func() {
				ts.Stop()
			})
Ejemplo n.º 2
0
	"github.com/cloudfoundry/cli/testhelpers/rpc_server"
	fake_rpc_handlers "github.com/cloudfoundry/cli/testhelpers/rpc_server/fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

const validPluginPath = "./test_rpc_server_example.exe"

var _ = Describe("App-Lister", func() {

	var (
		rpcHandlers *fake_rpc_handlers.FakeHandlers
		ts          *test_rpc_server.TestServer
		err         error
	)

	BeforeEach(func() {
		rpcHandlers = &fake_rpc_handlers.FakeHandlers{}
		ts, err = test_rpc_server.NewTestRpcServer(rpcHandlers)
		Ω(err).NotTo(HaveOccurred())

		err = ts.Start()
		Ω(err).NotTo(HaveOccurred())

		//set rpc.CallCoreCommand to a successful call
		//rpc.CallCoreCommand is used in both cliConnection.CliCommand() and
		//cliConnection.CliWithoutTerminalOutput()
		rpcHandlers.CallCoreCommandStub = func(_ []string, retVal *bool) error {
Ejemplo n.º 3
0
	Describe("GetMetadata()", func() {
		var (
			cmd DiegoEnabler
		)

		BeforeEach(func() {
			cmd = DiegoEnabler{}
		})

		It("contains 3 commands", func() {})
	})

	Describe("Commands", func() {
		var (
			rpcHandlers *fake_rpc_handlers.FakeHandlers
			ts          *test_rpc_server.TestServer
			err         error
		)

		BeforeEach(func() {
			rpcHandlers = &fake_rpc_handlers.FakeHandlers{}
			ts, err = test_rpc_server.NewTestRpcServer(rpcHandlers)
			Expect(err).NotTo(HaveOccurred())

			err = ts.Start()
			Expect(err).NotTo(HaveOccurred())

			//set rpc.CallCoreCommand to a successful call
			rpcHandlers.CallCoreCommandStub = func(_ []string, retVal *bool) error {
				*retVal = true
				return nil
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

const pluginPath = "./download-droplet-plugin"

var _ = Describe("DownloadDropletPlugin", func() {

	Describe("Run - integration tests", func() {
		var (
			rpcHandlers  *fake_rpc_handlers.FakeHandlers
			ts           *test_rpc_server.TestServer
			err          error
			pathToPlugin string
			args         []string
			badArgs      []string
		)

		BeforeSuite(func() {
			var err error
			pathToPlugin, err = gexec.Build("github.com/krujos/download_droplet_plugin")
			Ω(err).ShouldNot(HaveOccurred())
		})

		AfterSuite(func() {
			gexec.CleanupBuildArtifacts()
		})

		BeforeEach(func() {