Skip to content

Commit 47c0a91

Browse files
committed
Move GVK fields to public
1 parent ed6a067 commit 47c0a91

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

pkg/stores/sqlproxy/proxy_store.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ var (
6565
paramScheme = runtime.NewScheme()
6666
paramCodec = runtime.NewParameterCodec(paramScheme)
6767
// Please keep the gvkKey entries in alphabetical order, on a field-by-field basis
68-
typeSpecificIndexedFields = map[string][][]string{
69-
gvkKey("fruits.cattle.io", "v1", "Banana"): {
70-
{"color"},
71-
{"number"},
72-
{"numberString"},
73-
},
68+
TypeSpecificIndexedFields = map[string][][]string{
7469
gvkKey("", "v1", "Event"): {
7570
{"_type"},
7671
{"involvedObject", "kind"},
@@ -503,7 +498,7 @@ func (s *Store) initializeNamespaceCache() error {
503498
func getFieldForGVK(gvk schema.GroupVersionKind) [][]string {
504499
fields := [][]string{}
505500
fields = append(fields, commonIndexFields...)
506-
typeFields := typeSpecificIndexedFields[gvkKey(gvk.Group, gvk.Version, gvk.Kind)]
501+
typeFields := TypeSpecificIndexedFields[gvkKey(gvk.Group, gvk.Version, gvk.Kind)]
507502
if typeFields != nil {
508503
fields = append(fields, typeFields...)
509504
}

pkg/stores/sqlproxy/proxy_store_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func TestListByPartitions(t *testing.T) {
284284
Version: "test",
285285
Kind: "gvk",
286286
}
287-
typeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
287+
TypeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
288288

289289
setupContext(req)
290290
attributes.SetGVK(schema, gvk)
@@ -370,7 +370,7 @@ func TestListByPartitions(t *testing.T) {
370370
Version: "test",
371371
Kind: "gvk",
372372
}
373-
typeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
373+
TypeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
374374

375375
setupContext(req)
376376
attributes.SetGVK(schema, gvk)
@@ -448,7 +448,7 @@ func TestListByPartitions(t *testing.T) {
448448
Version: "test",
449449
Kind: "gvk",
450450
}
451-
typeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
451+
TypeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
452452

453453
attributes.SetGVK(schema, gvk)
454454
// ListByPartitions copies point so we need some original record of items to ensure as asserting listToReturn's
@@ -536,7 +536,7 @@ func TestListByPartitions(t *testing.T) {
536536
Version: "test",
537537
Kind: "gvk",
538538
}
539-
typeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
539+
TypeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
540540

541541
setupContext(req)
542542
attributes.SetGVK(schema, gvk)
@@ -625,7 +625,7 @@ func TestListByPartitions(t *testing.T) {
625625
Version: "test",
626626
Kind: "gvk",
627627
}
628-
typeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
628+
TypeSpecificIndexedFields["some_test_gvk"] = [][]string{{"gvk", "specific", "fields"}}
629629

630630
setupContext(req)
631631
attributes.SetGVK(schema, gvk)

tests/integration_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func (i *IntegrationSuite) SetupSuite() {
9292
sqlproxy.TypeGuidanceTable[schema.GroupVersionKind{Group: "fruits.cattle.io", Version: "v1", Kind: "Banana"}] = map[string]string{
9393
"number": "INT",
9494
}
95+
sqlproxy.TypeSpecificIndexedFields["fruits.cattle.io_v1_Banana"] = [][]string{
96+
{"color"},
97+
{"number"},
98+
{"numberString"},
99+
}
95100
}
96101

97102
func (i *IntegrationSuite) TearDownSuite() {

tests/testdata/filtering/scenario1.test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ customizations:
66
# - path: numberString
77
# - path: color
88
tests:
9+
- query: filter=color=green
10+
expected: [green]
911
- query: filter=metadata.name+IN+(yellow)
1012
expected: [yellow]
1113
- query: filter=metadata.name+NOTIN+(yellow)

0 commit comments

Comments
 (0)