mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +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 {
|
||||
NodeToIP map[string]map[string]string
|
||||
NodeToIP map[string]string
|
||||
Err error
|
||||
}
|
||||
|
||||
@ -838,15 +838,12 @@ func (f *fakeVMSet) GetInstanceTypeByNodeName(name string) (string, error) {
|
||||
return "", fmt.Errorf("unimplemented")
|
||||
}
|
||||
|
||||
func (f *fakeVMSet) GetIPByNodeName(name, vmSetName string) (string, string, error) {
|
||||
nodes, found := f.NodeToIP[vmSetName]
|
||||
if !found {
|
||||
return "", "", fmt.Errorf("not found")
|
||||
}
|
||||
ip, found := nodes[name]
|
||||
func (f *fakeVMSet) GetIPByNodeName(name string) (string, string, error) {
|
||||
ip, found := f.NodeToIP[name]
|
||||
if !found {
|
||||
return "", "", fmt.Errorf("not found")
|
||||
}
|
||||
|
||||
return ip, "", nil
|
||||
}
|
||||
|
||||
|
@ -94,10 +94,8 @@ func TestCreateRoute(t *testing.T) {
|
||||
route := cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/24"}
|
||||
|
||||
nodeIP := "2.4.6.8"
|
||||
fakeVM.NodeToIP = map[string]map[string]string{
|
||||
"": {
|
||||
"node": nodeIP,
|
||||
},
|
||||
fakeVM.NodeToIP = map[string]string{
|
||||
"node": nodeIP,
|
||||
}
|
||||
|
||||
err := cloud.CreateRoute(context.TODO(), "cluster", "unused", &route)
|
||||
|
Loading…
Reference in New Issue
Block a user