mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Fixup gonum.org/v1/gonum/graph API calls
This commit is contained in:
parent
27030079f3
commit
bba9f5e673
@ -268,7 +268,7 @@ func (h *debugHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
graph = h.controller.dependencyGraphBuilder.uidToNode.ToGonumGraph()
|
graph = h.controller.dependencyGraphBuilder.uidToNode.ToGonumGraph()
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := dot.Marshal(graph, "full", "", " ", false)
|
data, err := dot.Marshal(graph, "full", "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
@ -439,8 +439,8 @@ func TestToGonumGraphObj(t *testing.T) {
|
|||||||
func compareGraphs(expected, actual graph.Directed, t *testing.T) {
|
func compareGraphs(expected, actual graph.Directed, t *testing.T) {
|
||||||
// sort the edges by from ID, then to ID
|
// sort the edges by from ID, then to ID
|
||||||
// (the slices we get back are from map iteration, where order is not guaranteed)
|
// (the slices we get back are from map iteration, where order is not guaranteed)
|
||||||
expectedNodes := expected.Nodes()
|
expectedNodes := expected.Nodes().(graph.NodeSlicer).NodeSlice()
|
||||||
actualNodes := actual.Nodes()
|
actualNodes := actual.Nodes().(graph.NodeSlicer).NodeSlice()
|
||||||
sort.Sort(gonumByUID(expectedNodes))
|
sort.Sort(gonumByUID(expectedNodes))
|
||||||
sort.Sort(gonumByUID(actualNodes))
|
sort.Sort(gonumByUID(actualNodes))
|
||||||
|
|
||||||
@ -455,8 +455,8 @@ func compareGraphs(expected, actual graph.Directed, t *testing.T) {
|
|||||||
t.Errorf("expected %v, got %v", spew.Sdump(currExpected), spew.Sdump(currActual))
|
t.Errorf("expected %v, got %v", spew.Sdump(currExpected), spew.Sdump(currActual))
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedFrom := append([]graph.Node{}, expected.From(expectedNodes[i].ID())...)
|
expectedFrom := append([]graph.Node{}, expected.From(expectedNodes[i].ID()).(graph.NodeSlicer).NodeSlice()...)
|
||||||
actualFrom := append([]graph.Node{}, actual.From(actualNodes[i].ID())...)
|
actualFrom := append([]graph.Node{}, actual.From(actualNodes[i].ID()).(graph.NodeSlicer).NodeSlice()...)
|
||||||
sort.Sort(gonumByUID(expectedFrom))
|
sort.Sort(gonumByUID(expectedFrom))
|
||||||
sort.Sort(gonumByUID(actualFrom))
|
sort.Sort(gonumByUID(actualFrom))
|
||||||
if len(expectedFrom) != len(actualFrom) {
|
if len(expectedFrom) != len(actualFrom) {
|
||||||
|
Loading…
Reference in New Issue
Block a user