func NewCliApp() *cli.App { config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot()))) signalChan := make(chan os.Signal) signal.Notify(signalChan, os.Interrupt) exitHandler := exit_handler.New(signalChan, os.Exit) go exitHandler.Run() targetVerifier := target_verifier.New(receptor_client_factory.MakeReceptorClient) app := cli_app_factory.MakeCliApp(latticeVersion, ltcConfigRoot(), exitHandler, config, logger(), targetVerifier, os.Stdout) return app }
func NewCliApp() *cli.App { config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot()))) signalChan := make(chan os.Signal) signal.Notify(signalChan, os.Interrupt) exitHandler := exit_handler.New(signalChan, os.Exit) go exitHandler.Run() receptorClientCreator := receptor_client.ProxyAwareCreator{} return cli_app_factory.MakeCliApp( diegoVersion, latticeVersion, ltcConfigRoot(), exitHandler, config, logger(), receptorClientCreator, target_verifier.New(receptorClientCreator), os.Stdout, ) }
func NewCliApp() *cli.App { config := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(ltcConfigRoot()))) signalChan := make(chan os.Signal) signal.Notify(signalChan, os.Interrupt) exitHandler := exit_handler.New(signalChan, os.Exit) go exitHandler.Run() targetVerifier := target_verifier.New(func(target string) receptor.Client { return receptor.NewClient(target) }) return cli_app_factory.MakeCliApp( diegoVersion, latticeVersion, ltcConfigRoot(), exitHandler, config, logger(), targetVerifier, os.Stdout, ) }
}) AfterEach(func() { Expect(os.RemoveAll(tmpFile.Name())).To(Succeed()) }) Describe("Load", func() { var ( filePersister persister.Persister dataToRead *data ) BeforeEach(func() { dataToRead = &data{} filePersister = persister.NewFilePersister(tmpFile.Name()) }) JustBeforeEach(func() { err = filePersister.Load(dataToRead) }) It("Loads empty data from an empty file", func() { Expect(dataToRead.Value).To(BeEmpty()) }) Context("when the file already exists", func() { BeforeEach(func() { err := ioutil.WriteFile(tmpFile.Name(), []byte(`{"Value":"test value"}`), 0700) Expect(err).ToNot(HaveOccurred()) })
ghttp.VerifyRequest("GET", "/v1/actual_lrps"), ghttp.RespondWithJSONEncoded(http.StatusOK, actualResponse), ), ) fakeServer.RouteToHandler("GET", "/v1/tasks", ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/v1/tasks"), ghttp.RespondWithJSONEncoded(http.StatusOK, tasksResponse), ), ) var err error configRoot, err = ioutil.TempDir("", "config") Expect(err).NotTo(HaveOccurred()) ltcConfig := config.New(persister.NewFilePersister(config_helpers.ConfigFileLocation(configRoot))) listenerHost, listenerPort, err = net.SplitHostPort(listenerAddr) Expect(err).NotTo(HaveOccurred()) ltcConfig.SetTarget(fmt.Sprintf("%s.xip.io:%s", listenerHost, listenerPort)) Expect(ltcConfig.Save()).To(Succeed()) os.Setenv(latticeCliHomeVar, configRoot) }) AfterEach(func() { fakeServer.Close() Expect(os.RemoveAll(configRoot)).To(Succeed()) Expect(os.Unsetenv(latticeCliHomeVar)).To(Succeed()) }) ltcCommand := func(args ...string) *exec.Cmd {