You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Metadata service should be called only when calling newNodeService.
But in our current implementation, metadata service is called in NodeGetInfo Method inorder to get the pvmInstanceId.
func (d *nodeService) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
klog.V(4).Infof("NodeGetInfo: called with args %+v", *req)
metadata, err := cloud.NewMetadataService(cloud.DefaultKubernetesAPIClient)
if err != nil {
panic(err)
}
pvmInstanceId := metadata.GetPvmInstanceId()
in, err := d.cloud.GetPVMInstanceByID(pvmInstanceId)
....
....
}
While unit testing NodeGetInfo method, the test case will fail as if it is not running inside a pod.
This can be optimised by adding pvmInstanceId as part of NodeService when it is initialised as below.
This also allows our unit tests to run anywhere(could be out side cluster, inside cluster node).
If the metadata is other than service initialisation then we can run the unit tests only inside the pod as the metadata service uses in cluster configuration.
Referred EFS csi driver code for following this approach.
The text was updated successfully, but these errors were encountered:
Metadata service should be called only when calling newNodeService.
But in our current implementation, metadata service is called in NodeGetInfo Method inorder to get the pvmInstanceId.
While unit testing NodeGetInfo method, the test case will fail as if it is not running inside a pod.
This can be optimised by adding pvmInstanceId as part of NodeService when it is initialised as below.
This also allows our unit tests to run anywhere(could be out side cluster, inside cluster node).
If the metadata is other than service initialisation then we can run the unit tests only inside the pod as the metadata service uses in cluster configuration.
Referred EFS csi driver code for following this approach.
The text was updated successfully, but these errors were encountered: