|
|
|
@ -109,6 +109,7 @@ func makeDataQuery() *backend.DataQuery { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Test_treeToNestedDataFrame(t *testing.T) { |
|
|
|
|
t.Run("sample profile tree", func(t *testing.T) { |
|
|
|
|
tree := &ProfileTree{ |
|
|
|
|
Value: 100, Level: 0, Self: 1, Function: &Function{FunctionName: "root"}, Nodes: []*ProfileTree{ |
|
|
|
|
{ |
|
|
|
@ -145,6 +146,13 @@ func Test_treeToNestedDataFrame(t *testing.T) { |
|
|
|
|
data.NewField("label", nil, []int64{0, 1, 2, 3}).SetConfig(labelConfig), |
|
|
|
|
data.NewField("fileName", nil, []int64{0, 1, 2, 3}).SetConfig(filenameConfig), |
|
|
|
|
}, frame.Fields) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
t.Run("nil profile tree", func(t *testing.T) { |
|
|
|
|
frame := treeToNestedSetDataFrame(nil, "memory:alloc_objects:count:space:bytes") |
|
|
|
|
require.Equal(t, 6, len(frame.Fields)) |
|
|
|
|
require.Equal(t, 0, frame.Fields[0].Len()) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var fooProfile = &googlev1.Profile{ |
|
|
|
|