mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Fix unit tests for new interfaces
This commit is contained in:
parent
f427d279fe
commit
d32e73aba9
@ -826,7 +826,7 @@ func (fDC *fakeDisksClient) Get(ctx context.Context, resourceGroupName string, d
|
|||||||
}
|
}
|
||||||
|
|
||||||
type fakeVMSet struct {
|
type fakeVMSet struct {
|
||||||
NodeToIP map[string]map[string]string
|
NodeToIP map[string]string
|
||||||
Err error
|
Err error
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,15 +838,12 @@ func (f *fakeVMSet) GetInstanceTypeByNodeName(name string) (string, error) {
|
|||||||
return "", fmt.Errorf("unimplemented")
|
return "", fmt.Errorf("unimplemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeVMSet) GetIPByNodeName(name, vmSetName string) (string, string, error) {
|
func (f *fakeVMSet) GetIPByNodeName(name string) (string, string, error) {
|
||||||
nodes, found := f.NodeToIP[vmSetName]
|
ip, found := f.NodeToIP[name]
|
||||||
if !found {
|
|
||||||
return "", "", fmt.Errorf("not found")
|
|
||||||
}
|
|
||||||
ip, found := nodes[name]
|
|
||||||
if !found {
|
if !found {
|
||||||
return "", "", fmt.Errorf("not found")
|
return "", "", fmt.Errorf("not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return ip, "", nil
|
return ip, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,10 +94,8 @@ func TestCreateRoute(t *testing.T) {
|
|||||||
route := cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/24"}
|
route := cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/24"}
|
||||||
|
|
||||||
nodeIP := "2.4.6.8"
|
nodeIP := "2.4.6.8"
|
||||||
fakeVM.NodeToIP = map[string]map[string]string{
|
fakeVM.NodeToIP = map[string]string{
|
||||||
"": {
|
|
||||||
"node": nodeIP,
|
"node": nodeIP,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := cloud.CreateRoute(context.TODO(), "cluster", "unused", &route)
|
err := cloud.CreateRoute(context.TODO(), "cluster", "unused", &route)
|
||||||
|
Loading…
Reference in New Issue
Block a user