示例#1
0
文件: noop_test.go 项目: achanda/cni
			Expect(err).NotTo(HaveOccurred())
			Eventually(session).Should(gexec.Exit(0))
			Expect(session.Out.Contents()).To(MatchJSON(`{
				"some": "delete-data"
      }`))
			debug, err := noop_debug.ReadDebug(debugFileName)
			Expect(err).NotTo(HaveOccurred())
			Expect(debug.Command).To(Equal("DEL"))
			Expect(debug.CmdArgs).To(Equal(expectedCmdArgs))
		})
	})

	Context("when the CNI_COMMAND is VERSION", func() {
		BeforeEach(func() {
			cmd.Env[0] = "CNI_COMMAND=VERSION"
			debug.ReportVersionSupport = []string{"0.123.0", "0.2.0"}

			Expect(debug.WriteDebug(debugFileName)).To(Succeed())
		})

		It("claims to support the specified versions", func() {
			session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
			Expect(err).NotTo(HaveOccurred())
			Eventually(session).Should(gexec.Exit(0))
			decoder := &version.PluginDecoder{}
			pluginInfo, err := decoder.Decode(session.Out.Contents())
			Expect(err).NotTo(HaveOccurred())
			Expect(pluginInfo.SupportedVersions()).To(ConsistOf(
				"0.123.0", "0.2.0"))
		})
	})