spec/plugins: fix 'ip'->'ips' in the spec, bump to 0.3.1

This commit is contained in:
Dan Williams 2017-03-22 14:21:53 -05:00
parent 58b78e72fd
commit 29ba54c045
6 changed files with 12 additions and 12 deletions

View File

@ -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"}
})

View File

@ -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{}
})

View File

@ -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"]
}`))
})

View File

@ -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 {

View File

@ -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]}"))

View File

@ -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