apiserver/folders: use exact match on GetFolderByTitle in legacy (#106867)
* apiserver/folders: use exact match on GetFolderByTitle in legacy Signed-off-by: Maicon Costa <maiconscosta@gmail.com> --------- Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
@@ -310,11 +310,16 @@ func (s *Service) getFolderByTitleFromApiServer(ctx context.Context, orgID int64
|
||||
|
||||
request := &resourcepb.ResourceSearchRequest{
|
||||
Options: &resourcepb.ListOptions{
|
||||
Key: folderkey,
|
||||
Fields: []*resourcepb.Requirement{},
|
||||
Key: folderkey,
|
||||
Fields: []*resourcepb.Requirement{
|
||||
{
|
||||
Key: resource.SEARCH_FIELD_TITLE_PHRASE, // nolint:staticcheck
|
||||
Operator: string(selection.Equals),
|
||||
Values: []string{title},
|
||||
},
|
||||
},
|
||||
Labels: []*resourcepb.Requirement{},
|
||||
},
|
||||
Query: title,
|
||||
Limit: folderSearchLimit}
|
||||
|
||||
if parentUID != nil {
|
||||
|
||||
@@ -792,11 +792,16 @@ func TestGetFoldersFromApiServer(t *testing.T) {
|
||||
service.unifiedStore = fakeFolderStore
|
||||
fakeK8sClient.On("Search", mock.Anything, int64(1), &resourcepb.ResourceSearchRequest{
|
||||
Options: &resourcepb.ListOptions{
|
||||
Key: folderkey,
|
||||
Fields: []*resourcepb.Requirement{},
|
||||
Key: folderkey,
|
||||
Fields: []*resourcepb.Requirement{
|
||||
&resourcepb.Requirement{
|
||||
Key: resource.SEARCH_FIELD_TITLE_PHRASE, // nolint:staticcheck
|
||||
Operator: string(selection.Equals),
|
||||
Values: []string{"foo title"},
|
||||
},
|
||||
},
|
||||
Labels: []*resourcepb.Requirement{},
|
||||
},
|
||||
Query: "foo title",
|
||||
Limit: folderSearchLimit}).
|
||||
Return(&resourcepb.ResourceSearchResponse{
|
||||
Results: &resourcepb.ResourceTable{
|
||||
|
||||
Reference in New Issue
Block a user