|
|
|
@ -45,6 +45,7 @@ import ( |
|
|
|
|
"github.com/grafana/grafana/pkg/setting" |
|
|
|
|
"github.com/grafana/grafana/pkg/storage/legacysql/dualwrite" |
|
|
|
|
"github.com/grafana/grafana/pkg/storage/unified/resource" |
|
|
|
|
"github.com/grafana/grafana/pkg/storage/unified/resourcepb" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func TestDashboardService(t *testing.T) { |
|
|
|
@ -355,21 +356,21 @@ func TestGetDashboard(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
k8sCliMock.On("Get", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&dashboardUnstructured, nil).Once() |
|
|
|
|
k8sCliMock.On("GetUsersFromMeta", mock.Anything, mock.Anything).Return(map[string]*user.User{}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -567,36 +568,36 @@ func TestGetProvisionedDashboardData(t *testing.T) { |
|
|
|
|
}, nil).Once() |
|
|
|
|
repo := "test" |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), |
|
|
|
|
mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// make sure the kind is added to the query
|
|
|
|
|
return req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && // nolint:staticcheck
|
|
|
|
|
req.Options.Fields[1].Values[0] == repo |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{}, |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{}, |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{}, |
|
|
|
|
}, |
|
|
|
|
TotalHits: 0, |
|
|
|
|
}, nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// make sure the kind is added to the query
|
|
|
|
|
return req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && // nolint:staticcheck
|
|
|
|
|
req.Options.Fields[1].Values[0] == repo |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -670,28 +671,28 @@ func TestGetProvisionedDashboardDataByDashboardID(t *testing.T) { |
|
|
|
|
"title": "testing slugify", |
|
|
|
|
}, |
|
|
|
|
}}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{}, |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{}, |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{}, |
|
|
|
|
}, |
|
|
|
|
TotalHits: 0, |
|
|
|
|
}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -764,21 +765,21 @@ func TestGetProvisionedDashboardDataByDashboardUID(t *testing.T) { |
|
|
|
|
"title": "testing slugify", |
|
|
|
|
}, |
|
|
|
|
}}, nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -873,24 +874,24 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
"spec": map[string]any{}, |
|
|
|
|
}}, nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// nolint:staticcheck
|
|
|
|
|
return req.Options.Fields[0].Key == "manager.kind" && req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && req.Options.Fields[1].Key == "manager.id" && req.Options.Fields[1].Values[0] == "test" && req.Options.Fields[1].Operator == "notin" |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -904,24 +905,24 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
TotalHits: 1, |
|
|
|
|
}, nil).Once() |
|
|
|
|
|
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(2), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// nolint:staticcheck
|
|
|
|
|
return req.Options.Fields[0].Key == "manager.kind" && req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && req.Options.Fields[1].Key == "manager.id" && req.Options.Fields[1].Values[0] == "test" && req.Options.Fields[1].Operator == "notin" |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid2", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -931,7 +932,7 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid3", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -946,8 +947,8 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
}, nil).Once() |
|
|
|
|
|
|
|
|
|
// mock call to waitForSearchQuery()
|
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{}, |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{}, |
|
|
|
|
TotalHits: 0, |
|
|
|
|
}, nil).Twice() |
|
|
|
|
|
|
|
|
@ -998,25 +999,25 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// make sure the kind is added to the query
|
|
|
|
|
return req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && // nolint:staticcheck
|
|
|
|
|
req.Options.Fields[1].Values[0] == repo |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1035,14 +1036,14 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
|
|
|
|
|
// Mock WaitForSearchQuery()
|
|
|
|
|
// First call returns 1 hit
|
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{}, |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{}, |
|
|
|
|
TotalHits: 1, |
|
|
|
|
}, nil).Once() |
|
|
|
|
|
|
|
|
|
// Second call returns 0 hits
|
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{}, |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{}, |
|
|
|
|
TotalHits: 0, |
|
|
|
|
}, nil).Once() |
|
|
|
|
|
|
|
|
@ -1068,12 +1069,12 @@ func TestDeleteOrphanedProvisionedDashboards(t *testing.T) { |
|
|
|
|
|
|
|
|
|
// Call to searchProvisionedDashboardsThroughK8s()
|
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
// make sure the kind is added to the query
|
|
|
|
|
return req.Options.Fields[0].Values[0] == string(utils.ManagerKindClassicFP) && // nolint:staticcheck
|
|
|
|
|
req.Options.Fields[1].Values[0] == repo |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{}, |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{}, |
|
|
|
|
TotalHits: 0, |
|
|
|
|
}, nil) |
|
|
|
|
|
|
|
|
@ -1140,21 +1141,21 @@ func TestUnprovisionDashboard(t *testing.T) { |
|
|
|
|
}).Return(dashWithoutAnnotations, nil) |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("GetUsersFromMeta", mock.Anything, mock.Anything).Return(map[string]*user.User{}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1208,25 +1209,25 @@ func TestGetDashboardsByPluginID(t *testing.T) { |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Get", mock.Anything, "uid", mock.Anything, mock.Anything, mock.Anything).Return(uidUnstructured, nil) |
|
|
|
|
k8sCliMock.On("GetUsersFromMeta", mock.Anything, mock.Anything).Return(map[string]*user.User{}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
return ( // gofmt comment helper
|
|
|
|
|
req.Options.Fields[0].Key == "manager.kind" && req.Options.Fields[0].Values[0] == string(utils.ManagerKindPlugin) && |
|
|
|
|
req.Options.Fields[1].Key == "manager.id" && req.Options.Fields[1].Values[0] == "testing") |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1496,21 +1497,21 @@ func TestDeleteDashboard(t *testing.T) { |
|
|
|
|
ctx, k8sCliMock := setupK8sDashboardTests(service) |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Delete", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1648,25 +1649,25 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
fakeFolders.ExpectedHitList = expectedFolders |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "tags", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid1", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1677,7 +1678,7 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid2", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1702,7 +1703,7 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
ctx, k8sCliMock := setupK8sDashboardTests(service) |
|
|
|
|
service.features = featuremgmt.WithFeatures(featuremgmt.FlagNestedFolders, featuremgmt.FlagKubernetesClientDashboardsFolders) |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
if len(req.Options.Fields) == 0 { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
@ -1713,25 +1714,25 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "tags", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "shared-uid1", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1745,7 +1746,7 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
TotalHits: 1, |
|
|
|
|
}, nil).Once() |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, int64(1), mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
if len(req.Options.Fields) == 0 { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
@ -1755,25 +1756,25 @@ func TestSearchDashboards(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "tags", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "shared-uid1", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1878,21 +1879,21 @@ func TestGetDashboards(t *testing.T) { |
|
|
|
|
k8sCliMock.On("Get", mock.Anything, "uid1", mock.Anything, mock.Anything, mock.Anything).Return(uid1Unstructured, nil) |
|
|
|
|
k8sCliMock.On("Get", mock.Anything, "uid2", mock.Anything, mock.Anything, mock.Anything).Return(uid2Unstructured, nil) |
|
|
|
|
k8sCliMock.On("GetUsersFromMeta", mock.Anything, mock.Anything).Return(map[string]*user.User{}, nil) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid1", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1902,7 +1903,7 @@ func TestGetDashboards(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid2", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -1959,21 +1960,21 @@ func TestGetDashboardUIDByID(t *testing.T) { |
|
|
|
|
t.Run("Should use Kubernetes client if feature flags are enabled", func(t *testing.T) { |
|
|
|
|
ctx, k8sCliMock := setupK8sDashboardTests(service) |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid1", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2078,10 +2079,10 @@ func TestGetDashboardTags(t *testing.T) { |
|
|
|
|
|
|
|
|
|
t.Run("Should use Kubernetes client if feature flags are enabled", func(t *testing.T) { |
|
|
|
|
ctx, k8sCliMock := setupK8sDashboardTests(service) |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Facet: map[string]*resource.ResourceSearchResponse_Facet{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Facet: map[string]*resourcepb.ResourceSearchResponse_Facet{ |
|
|
|
|
"tags": { |
|
|
|
|
Terms: []*resource.ResourceSearchResponse_TermFacet{ |
|
|
|
|
Terms: []*resourcepb.ResourceSearchResponse_TermFacet{ |
|
|
|
|
{ |
|
|
|
|
Term: "tag1", |
|
|
|
|
Count: 1, |
|
|
|
@ -2119,15 +2120,15 @@ func TestQuotaCount(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
countOrg1 := resource.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resource.ResourceStatsResponse_Stats{ |
|
|
|
|
countOrg1 := resourcepb.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resourcepb.ResourceStatsResponse_Stats{ |
|
|
|
|
{ |
|
|
|
|
Count: 1, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
countOrg2 := resource.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resource.ResourceStatsResponse_Stats{ |
|
|
|
|
countOrg2 := resourcepb.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resourcepb.ResourceStatsResponse_Stats{ |
|
|
|
|
{ |
|
|
|
|
Count: 2, |
|
|
|
|
}, |
|
|
|
@ -2176,8 +2177,8 @@ func TestCountDashboardsInOrg(t *testing.T) { |
|
|
|
|
cfg: setting.NewCfg(), |
|
|
|
|
dashboardStore: &fakeStore, |
|
|
|
|
} |
|
|
|
|
count := resource.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resource.ResourceStatsResponse_Stats{ |
|
|
|
|
count := resourcepb.ResourceStatsResponse{ |
|
|
|
|
Stats: []*resourcepb.ResourceStatsResponse_Stats{ |
|
|
|
|
{ |
|
|
|
|
Count: 3, |
|
|
|
|
}, |
|
|
|
@ -2208,21 +2209,21 @@ func TestCountInFolders(t *testing.T) { |
|
|
|
|
cfg: setting.NewCfg(), |
|
|
|
|
dashboardStore: &fakeStore, |
|
|
|
|
} |
|
|
|
|
dashs := &resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
dashs := &resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2232,7 +2233,7 @@ func TestCountInFolders(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid2", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2273,26 +2274,26 @@ func TestSearchDashboardsThroughK8sRaw(t *testing.T) { |
|
|
|
|
Sort: sort.SortAlphaAsc, |
|
|
|
|
} |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.MatchedBy(func(req *resource.ResourceSearchRequest) bool { |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.MatchedBy(func(req *resourcepb.ResourceSearchRequest) bool { |
|
|
|
|
return len(req.SortBy) == 1 && |
|
|
|
|
// should be converted to "title" due to ParseSortName
|
|
|
|
|
req.SortBy[0].Field == "title" && |
|
|
|
|
!req.SortBy[0].Desc |
|
|
|
|
})).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
})).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2347,21 +2348,21 @@ func TestSearchProvisionedDashboardsThroughK8sRaw(t *testing.T) { |
|
|
|
|
"spec": map[string]any{}, |
|
|
|
|
}} |
|
|
|
|
k8sCliMock.On("GetNamespace", mock.Anything, mock.Anything).Return("default") |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resource.ResourceSearchResponse{ |
|
|
|
|
Results: &resource.ResourceTable{ |
|
|
|
|
Columns: []*resource.ResourceTableColumnDefinition{ |
|
|
|
|
k8sCliMock.On("Search", mock.Anything, mock.Anything, mock.Anything).Return(&resourcepb.ResourceSearchResponse{ |
|
|
|
|
Results: &resourcepb.ResourceTable{ |
|
|
|
|
Columns: []*resourcepb.ResourceTableColumnDefinition{ |
|
|
|
|
{ |
|
|
|
|
Name: "title", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Name: "folder", |
|
|
|
|
Type: resource.ResourceTableColumnDefinition_STRING, |
|
|
|
|
Type: resourcepb.ResourceTableColumnDefinition_STRING, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
Rows: []*resource.ResourceTableRow{ |
|
|
|
|
Rows: []*resourcepb.ResourceTableRow{ |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2371,7 +2372,7 @@ func TestSearchProvisionedDashboardsThroughK8sRaw(t *testing.T) { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
Key: &resource.ResourceKey{ |
|
|
|
|
Key: &resourcepb.ResourceKey{ |
|
|
|
|
Name: "uid2", |
|
|
|
|
Resource: "dashboard", |
|
|
|
|
}, |
|
|
|
@ -2514,7 +2515,7 @@ func TestSetDefaultPermissionsAfterCreate(t *testing.T) { |
|
|
|
|
service.RegisterDashboardPermissions(permService) |
|
|
|
|
|
|
|
|
|
// Create test object
|
|
|
|
|
key := &resource.ResourceKey{Group: "dashboard.grafana.app", Resource: "dashboards", Name: "test", Namespace: "default"} |
|
|
|
|
key := &resourcepb.ResourceKey{Group: "dashboard.grafana.app", Resource: "dashboards", Name: "test", Namespace: "default"} |
|
|
|
|
obj := &dashboardv0.Dashboard{ |
|
|
|
|
TypeMeta: metav1.TypeMeta{ |
|
|
|
|
APIVersion: "dashboard.grafana.app/v0alpha1", |
|
|
|
|