Expect(err).NotTo(HaveOccurred())
Expect(result).To(Equal(¤t.Result{
+ CNIVersion: current.ImplementedSpecVersion,
IPs: []*current.IPConfig{
{
Version: "4",
Expect(err).NotTo(HaveOccurred())
Expect(result).To(Equal(¤t.Result{
+ CNIVersion: current.ImplementedSpecVersion,
// IP4 added by first plugin
IPs: []*current.IPConfig{
{
"github.com/containernetworking/cni/pkg/types/020"
)
-const implementedSpecVersion string = "0.3.1"
+const ImplementedSpecVersion string = "0.3.1"
-var SupportedVersions = []string{"0.3.0", implementedSpecVersion}
+var SupportedVersions = []string{"0.3.0", ImplementedSpecVersion}
func NewResult(data []byte) (types.Result, error) {
result := &Result{}
}
func GetResult(r types.Result) (*Result, error) {
- resultCurrent, err := r.GetAsVersion(implementedSpecVersion)
+ resultCurrent, err := r.GetAsVersion(ImplementedSpecVersion)
if err != nil {
return nil, err
}
}
newResult := &Result{
- CNIVersion: implementedSpecVersion,
+ CNIVersion: ImplementedSpecVersion,
DNS: oldResult.DNS,
Routes: []*types.Route{},
}
if !ok {
return nil, fmt.Errorf("failed to convert result")
}
- newResult.CNIVersion = implementedSpecVersion
+ newResult.CNIVersion = ImplementedSpecVersion
return newResult, nil
}
}
func (r *Result) Version() string {
- return implementedSpecVersion
+ return ImplementedSpecVersion
}
func (r *Result) GetAsVersion(version string) (types.Result, error) {
switch version {
- case "0.3.0", implementedSpecVersion:
+ case "0.3.0", ImplementedSpecVersion:
r.CNIVersion = version
return r, nil
case types020.SupportedVersions[0], types020.SupportedVersions[1], types020.SupportedVersions[2]:
Expect(err).NotTo(HaveOccurred())
Eventually(session).Should(gexec.Exit(0))
Expect(session.Out.Contents()).To(MatchJSON(`{
+ "cniVersion": "0.3.1",
"ips": [{"version": "4", "address": "10.1.2.3/24"}],
"dns": {"nameservers": ["1.2.3.4"]}
}`))