Beispiel #1
0
func callCoreCommand(args []string, theApp *cli.App) {
	err := theApp.Run(args)
	if err != nil {
		os.Exit(1)
	}
	gateways := gatewaySliceFromMap(deps.gateways)

	warningsCollector := net.NewWarningsCollector(deps.termUI, gateways...)
	warningsCollector.PrintWarnings()
}
Beispiel #2
0
		AfterEach(func() {
			os.Setenv("CF_RAISE_ERROR_ON_WARNINGS", oldRaiseErrorValue)
		})

		Context("when the CF_RAISE_ERROR_ON_WARNINGS environment variable is set", func() {
			BeforeEach(func() {
				os.Setenv("CF_RAISE_ERROR_ON_WARNINGS", "true")
			})

			Context("when there are warnings", func() {
				BeforeEach(func() {
					warning_producer_one := testnet.NewWarningProducer([]string{"Hello", "Darling"})
					warning_producer_two := testnet.NewWarningProducer([]string{"Goodbye", "Sweetie"})
					warning_producer_three := testnet.NewWarningProducer(nil)
					warningsCollector = net.NewWarningsCollector(ui, warning_producer_one, warning_producer_two, warning_producer_three)
				})

				It("panics with an error that contains all the warnings", func() {
					Expect(warningsCollector.PrintWarnings).To(Panic())
				})
			})

			Context("when there are no warnings", func() {
				BeforeEach(func() {
					warningsCollector = net.NewWarningsCollector(ui)
				})

				It("does not panic", func() {
					Expect(warningsCollector.PrintWarnings).NotTo(Panic())
				})