Пример #1
0
		Context("when the plugin errors", func() {
			BeforeEach(func() {
				debug.ReportError = "plugin error: banana"
				Expect(debug.WriteDebug(debugFilePath)).To(Succeed())
			})
			It("unmarshals and returns the error", func() {
				result, err := cniConfig.AddNetwork(netConfig, runtimeConfig)
				Expect(result).To(BeNil())
				Expect(err).To(MatchError("plugin error: banana"))
			})
		})
	})

	Describe("DelNetwork", func() {
		It("executes the plugin with command DEL", func() {
			err := cniConfig.DelNetwork(netConfig, runtimeConfig)
			Expect(err).NotTo(HaveOccurred())

			debug, err := noop_debug.ReadDebug(debugFilePath)
			Expect(err).NotTo(HaveOccurred())
			Expect(debug.Command).To(Equal("DEL"))
			Expect(debug.CmdArgs).To(Equal(expectedCmdArgs))
		})

		Context("when finding the plugin fails", func() {
			BeforeEach(func() {
				netConfig.Network.Type = "does-not-exist"
			})

			It("returns the error", func() {
				err := cniConfig.DelNetwork(netConfig, runtimeConfig)