From 29ba54c045f272b828fe791ec7845c1af95861ef Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 22 Mar 2017 14:21:53 -0500 Subject: [PATCH] spec/plugins: fix 'ip'->'ips' in the spec, bump to 0.3.1 --- invoke/exec_test.go | 2 +- invoke/raw_exec_test.go | 2 +- skel/skel_test.go | 4 ++-- types/current/types.go | 10 +++++----- types/current/types_test.go | 2 +- version/version.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/invoke/exec_test.go b/invoke/exec_test.go index 7e804ab7..33ffc2de 100644 --- a/invoke/exec_test.go +++ b/invoke/exec_test.go @@ -50,7 +50,7 @@ var _ = Describe("Executing a plugin, unit tests", func() { VersionDecoder: versionDecoder, } pluginPath = "/some/plugin/path" - netconf = []byte(`{ "some": "stdin", "cniVersion": "0.3.0" }`) + netconf = []byte(`{ "some": "stdin", "cniVersion": "0.3.1" }`) cniargs = &fakes.CNIArgs{} cniargs.AsEnvCall.Returns.Env = []string{"SOME=ENV"} }) diff --git a/invoke/raw_exec_test.go b/invoke/raw_exec_test.go index 5ab23ae5..5d759f24 100644 --- a/invoke/raw_exec_test.go +++ b/invoke/raw_exec_test.go @@ -58,7 +58,7 @@ var _ = Describe("RawExec", func() { "CNI_PATH=/some/bin/path", "CNI_IFNAME=some-eth0", } - stdin = []byte(`{"some":"stdin-json", "cniVersion": "0.3.0"}`) + stdin = []byte(`{"some":"stdin-json", "cniVersion": "0.3.1"}`) execer = &invoke.RawExec{} }) diff --git a/skel/skel_test.go b/skel/skel_test.go index d7f729f0..ad293084 100644 --- a/skel/skel_test.go +++ b/skel/skel_test.go @@ -226,7 +226,7 @@ var _ = Describe("dispatching to the correct callback", func() { Expect(err).NotTo(HaveOccurred()) Expect(stdout).To(MatchJSON(`{ - "cniVersion": "0.3.0", + "cniVersion": "0.3.1", "supportedVersions": ["9.8.7"] }`)) }) @@ -258,7 +258,7 @@ var _ = Describe("dispatching to the correct callback", func() { Expect(err).NotTo(HaveOccurred()) Expect(stdout).To(MatchJSON(`{ - "cniVersion": "0.3.0", + "cniVersion": "0.3.1", "supportedVersions": ["9.8.7"] }`)) }) diff --git a/types/current/types.go b/types/current/types.go index e686a9a7..b89a5d3a 100644 --- a/types/current/types.go +++ b/types/current/types.go @@ -24,9 +24,9 @@ import ( "github.com/containernetworking/cni/pkg/types/020" ) -const implementedSpecVersion string = "0.3.0" +const implementedSpecVersion string = "0.3.1" -var SupportedVersions = []string{implementedSpecVersion} +var SupportedVersions = []string{"0.3.0", implementedSpecVersion} func NewResult(data []byte) (types.Result, error) { result := &Result{} @@ -129,7 +129,7 @@ func NewResultFromResult(result types.Result) (*Result, error) { } } } - return nil, fmt.Errorf("unsupported CNI result version %q", version) + return nil, fmt.Errorf("unsupported CNI result22 version %q", version) } // Result is what gets returned from the plugin (via stdout) to the caller @@ -194,12 +194,12 @@ func (r *Result) Version() string { func (r *Result) GetAsVersion(version string) (types.Result, error) { switch version { - case implementedSpecVersion: + case "0.3.0", implementedSpecVersion: return r, nil case types020.SupportedVersions[0], types020.SupportedVersions[1], types020.SupportedVersions[2]: return r.convertTo020() } - return nil, fmt.Errorf("cannot convert version 0.3.0 to %q", version) + return nil, fmt.Errorf("cannot convert version 0.3.x to %q", version) } func (r *Result) Print() error { diff --git a/types/current/types_test.go b/types/current/types_test.go index c5012752..9d29cf22 100644 --- a/types/current/types_test.go +++ b/types/current/types_test.go @@ -82,7 +82,7 @@ func testResult() *current.Result { } var _ = Describe("Current types operations", func() { - It("correctly encodes a 0.3.0 Result", func() { + It("correctly encodes a 0.3.x Result", func() { res := testResult() Expect(res.String()).To(Equal("Interfaces:[{Name:eth0 Mac:00:11:22:33:44:55 Sandbox:/proc/3553/ns/net}], IP:[{Version:4 Interface:0 Address:{IP:1.2.3.30 Mask:ffffff00} Gateway:1.2.3.1} {Version:6 Interface:0 Address:{IP:abcd:1234:ffff::cdde Mask:ffffffffffffffff0000000000000000} Gateway:abcd:1234:ffff::1}], Routes:[{Dst:{IP:15.5.6.0 Mask:ffffff00} GW:15.5.6.8} {Dst:{IP:1111:dddd:: Mask:ffffffffffffffffffff000000000000} GW:1111:dddd::aaaa}], DNS:{Nameservers:[1.2.3.4 1::cafe] Domain:acompany.com Search:[somedomain.com otherdomain.net] Options:[foo bar]}")) diff --git a/version/version.go b/version/version.go index 7c589633..efe8ea87 100644 --- a/version/version.go +++ b/version/version.go @@ -24,7 +24,7 @@ import ( // Current reports the version of the CNI spec implemented by this library func Current() string { - return "0.3.0" + return "0.3.1" } // Legacy PluginInfo describes a plugin that is backwards compatible with the @@ -35,7 +35,7 @@ func Current() string { // Any future CNI spec versions which meet this definition should be added to // this list. var Legacy = PluginSupports("0.1.0", "0.2.0") -var All = PluginSupports("0.1.0", "0.2.0", "0.3.0") +var All = PluginSupports("0.1.0", "0.2.0", "0.3.0", "0.3.1") var resultFactories = []struct { supportedVersions []string