Commit 46218870 authored by David Zhu's avatar David Zhu

Updated test files with new fields

parent 3595dee6
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"time" "time"
"fmt" "fmt"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
...@@ -216,11 +217,22 @@ func Test_nodePlugin_Admit(t *testing.T) { ...@@ -216,11 +217,22 @@ func Test_nodePlugin_Admit(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "mynode", Name: "mynode",
}, },
CSIDrivers: []csiv1alpha1.CSIDriverInfo{ Spec: csiv1alpha1.CSINodeInfoSpec{
{ Drivers: []csiv1alpha1.CSIDriverInfoSpec{
Driver: "com.example.csi/mydriver", {
NodeID: "com.example.csi/mynode", Name: "com.example.csi/mydriver",
TopologyKeys: []string{"com.example.csi/zone"}, NodeID: "com.example.csi/mynode",
TopologyKeys: []string{"com.example.csi/zone"},
},
},
},
Status: csiv1alpha1.CSINodeInfoStatus{
Drivers: []csiv1alpha1.CSIDriverInfoStatus{
{
Name: "com.example.csi/mydriver",
Available: true,
VolumePluginMechanism: csiv1alpha1.VolumePluginMechanismInTree,
},
}, },
}, },
} }
...@@ -228,11 +240,22 @@ func Test_nodePlugin_Admit(t *testing.T) { ...@@ -228,11 +240,22 @@ func Test_nodePlugin_Admit(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
}, },
CSIDrivers: []csiv1alpha1.CSIDriverInfo{ Spec: csiv1alpha1.CSINodeInfoSpec{
{ Drivers: []csiv1alpha1.CSIDriverInfoSpec{
Driver: "com.example.csi/mydriver", {
NodeID: "com.example.csi/foo", Name: "com.example.csi/mydriver",
TopologyKeys: []string{"com.example.csi/zone"}, NodeID: "com.example.csi/foo",
TopologyKeys: []string{"com.example.csi/zone"},
},
},
},
Status: csiv1alpha1.CSINodeInfoStatus{
Drivers: []csiv1alpha1.CSIDriverInfoStatus{
{
Name: "com.example.csi/mydriver",
Available: true,
VolumePluginMechanism: csiv1alpha1.VolumePluginMechanismInTree,
},
}, },
}, },
} }
......
...@@ -420,11 +420,22 @@ func TestNodeAuthorizer(t *testing.T) { ...@@ -420,11 +420,22 @@ func TestNodeAuthorizer(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "node1", Name: "node1",
}, },
CSIDrivers: []csiv1alpha1.CSIDriverInfo{ Spec: csiv1alpha1.CSINodeInfoSpec{
{ Drivers: []csiv1alpha1.CSIDriverInfoSpec{
Driver: "com.example.csi/driver1", {
NodeID: "com.example.csi/node1", Name: "com.example.csi/driver1",
TopologyKeys: []string{"com.example.csi/zone"}, NodeID: "com.example.csi/node1",
TopologyKeys: []string{"com.example.csi/zone"},
},
},
},
Status: csiv1alpha1.CSINodeInfoStatus{
Drivers: []csiv1alpha1.CSIDriverInfoStatus{
{
Name: "com.example.csi/driver1",
Available: true,
VolumePluginMechanism: csiv1alpha1.VolumePluginMechanismInTree,
},
}, },
}, },
} }
...@@ -438,13 +449,20 @@ func TestNodeAuthorizer(t *testing.T) { ...@@ -438,13 +449,20 @@ func TestNodeAuthorizer(t *testing.T) {
if err != nil { if err != nil {
return err return err
} }
nodeInfo.CSIDrivers = []csiv1alpha1.CSIDriverInfo{ nodeInfo.Spec.Drivers = []csiv1alpha1.CSIDriverInfoSpec{
{ {
Driver: "com.example.csi/driver1", Name: "com.example.csi/driver1",
NodeID: "com.example.csi/node1", NodeID: "com.example.csi/node1",
TopologyKeys: []string{"com.example.csi/rack"}, TopologyKeys: []string{"com.example.csi/rack"},
}, },
} }
nodeInfo.Status.Drivers = []csiv1alpha1.CSIDriverInfoStatus{
{
Name: "com.example.csi/driver1",
Available: true,
VolumePluginMechanism: csiv1alpha1.VolumePluginMechanismInTree,
},
}
_, err = client.CsiV1alpha1().CSINodeInfos().Update(nodeInfo) _, err = client.CsiV1alpha1().CSINodeInfos().Update(nodeInfo)
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment