Exemple #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() {
				err := cniConfig.DelNetwork(netConfig, runtimeConfig)
				Expect(err).To(MatchError("plugin error: banana"))
			})
		})
	})

	Describe("GetVersionInfo", func() {
		It("executes the plugin with the command VERSION", func() {
			versionInfo, err := cniConfig.GetVersionInfo("noop")
			Expect(err).NotTo(HaveOccurred())

			Expect(versionInfo).NotTo(BeNil())
			Expect(versionInfo.SupportedVersions()).To(Equal([]string{
				"0.-42.0", "0.1.0", "0.2.0",
			}))
		})

		Context("when finding the plugin fails", func() {
			It("returns the error", func() {
				_, err := cniConfig.GetVersionInfo("does-not-exist")
				Expect(err).To(MatchError(ContainSubstring(`failed to find plugin "does-not-exist"`)))
			})
		})
	})