Skip to content

Commit

Permalink
chore: fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Jan 10, 2025
1 parent c514ca3 commit 9b95a10
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions tests/query_resource_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 9b95a10

Please sign in to comment.