Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: grammar should parse * and no field words #1261

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: fix more tests
  • Loading branch information
yashmehrotra committed Jan 10, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 9b95a103ff6e2feabcb64cb71597fb47a0098f04
65 changes: 33 additions & 32 deletions tests/query_resource_selector_test.go
Original file line number Diff line number Diff line change
@@ -56,59 +56,60 @@ var _ = ginkgo.Describe("SearchResourceSelectors", func() {
{
description: "name prefix | components",
query: query.SearchResourcesRequest{
Components: []types.ResourceSelector{{Search: "logistics-", Types: []string{"Application"}}},
Components: []types.ResourceSelector{{Search: "logistics-*", Types: []string{"Application"}}},
},
Components: []models.Component{dummy.LogisticsAPI, dummy.LogisticsUI, dummy.LogisticsWorker},
},
{
description: "name prefix | checks",
query: query.SearchResourcesRequest{
Checks: []types.ResourceSelector{{Search: "logistics-", Types: []string{"http"}}},
Checks: []types.ResourceSelector{{Search: "logistics-*", Types: []string{"http"}}},
},
Checks: []models.Check{dummy.LogisticsAPIHomeHTTPCheck, dummy.LogisticsAPIHealthHTTPCheck},
},
{
description: "name prefix | configs",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{Search: "node"}},
Configs: []types.ResourceSelector{{Search: "node*"}},
},
Configs: []models.ConfigItem{dummy.KubernetesNodeA, dummy.KubernetesNodeB},
},
{
description: "name prefix with label selector",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{Search: "node", LabelSelector: "region=us-west-2"}},
Configs: []types.ResourceSelector{{Search: "node*)", LabelSelector: "region=us-west-2"}},
},
Configs: []models.ConfigItem{dummy.KubernetesNodeB},
},
{
description: "tag prefix - eg #1",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "aws"}},
},
Configs: []models.ConfigItem{dummy.EKSCluster},
},
{
description: "tag prefix - eg #2",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "demo"}},
},
Configs: []models.ConfigItem{dummy.KubernetesCluster},
},
{
description: "label prefix - eg #1",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "prod"}},
},
Configs: []models.ConfigItem{dummy.EKSCluster},
},
{
description: "label prefix - eg #2",
query: query.SearchResourcesRequest{
Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "develop"}},
},
Configs: []models.ConfigItem{dummy.KubernetesCluster},
},
// TODO: Currently search does not support labels/tags
//{
//description: "tag prefix - eg #1",
//query: query.SearchResourcesRequest{
//Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "aws*"}},
//},
//Configs: []models.ConfigItem{dummy.EKSCluster},
//},
//{
//description: "tag prefix - eg #2",
//query: query.SearchResourcesRequest{
//Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "demo*"}},
//},
//Configs: []models.ConfigItem{dummy.KubernetesCluster},
//},
//{
//description: "label prefix - eg #1",
//query: query.SearchResourcesRequest{
//Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "prod*"}},
//},
//Configs: []models.ConfigItem{dummy.EKSCluster},
//},
//{
//description: "label prefix - eg #2",
//query: query.SearchResourcesRequest{
//Configs: []types.ResourceSelector{{FieldSelector: fmt.Sprintf("config_class=%s", models.ConfigClassCluster), Search: "develop*"}},
//},
//Configs: []models.ConfigItem{dummy.KubernetesCluster},
//},
{
description: "labels | Equals Query",
query: query.SearchResourcesRequest{
Loading