Skip to content

Commit 83ea7c4

Browse files
authored
feat(bigtable): Update ListSchemaBundles to returns only names (#12563)
* feat(bigtable): Update ListSchemaBundles to returns only names * fix format
1 parent 698ddea commit 83ea7c4

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

bigtable/admin.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,8 +3515,8 @@ func (ac *AdminClient) GetSchemaBundle(ctx context.Context, tableID, schemaBundl
35153515
}
35163516

35173517
// SchemaBundles returns a list of the schema bundles in the table.
3518-
func (ac *AdminClient) SchemaBundles(ctx context.Context, tableID string) ([]SchemaBundleInfo, error) {
3519-
bundles := []SchemaBundleInfo{}
3518+
func (ac *AdminClient) SchemaBundles(ctx context.Context, tableID string) ([]string, error) {
3519+
names := []string{}
35203520
prefix := fmt.Sprintf("%s/tables/%s", ac.instancePrefix(), tableID)
35213521

35223522
req := &btapb.ListSchemaBundlesRequest{
@@ -3533,17 +3533,9 @@ func (ac *AdminClient) SchemaBundles(ctx context.Context, tableID string) ([]Sch
35333533
}
35343534

35353535
for _, res := range res.SchemaBundles {
3536-
sb := SchemaBundleInfo{
3537-
TableID: tableID,
3538-
SchemaBundleID: strings.TrimPrefix(res.Name, prefix+"/schemaBundles/"),
3539-
Etag: res.Etag,
3540-
}
3541-
if len(res.GetProtoSchema().GetProtoDescriptors()) > 0 {
3542-
sb.SchemaBundle = res.GetProtoSchema().GetProtoDescriptors()
3543-
}
3544-
bundles = append(bundles, sb)
3536+
names = append(names, strings.TrimPrefix(res.Name, prefix+"/schemaBundles/"))
35453537
}
3546-
return bundles, nil
3538+
return names, nil
35473539
}
35483540

35493541
// UpdateSchemaBundleConf contains all the information necessary to update or partial update a schema bundle.

bigtable/integration_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4992,12 +4992,9 @@ func TestIntegration_AdminSchemaBundle(t *testing.T) {
49924992
if got, want := len(schemaBundles), 1; got != want {
49934993
t.Fatalf("Listing schema bundles count: %d, want: != %d", got, want)
49944994
}
4995-
if got, want := schemaBundles[0].SchemaBundleID, schemaBundle; got != want {
4995+
if got, want := schemaBundles[0], schemaBundle; got != want {
49964996
t.Errorf("SchemaBundle Name: %s, want: %s", got, want)
49974997
}
4998-
if got, want := schemaBundles[0].SchemaBundle, content; !reflect.DeepEqual(got, want) {
4999-
t.Errorf("ProtoSchema: %v, want: %v", got, want)
5000-
}
50014998

50024999
// Get schema bundle
50035000
sbInfo, err := adminClient.GetSchemaBundle(ctx, tblConf.TableID, schemaBundle)

0 commit comments

Comments
 (0)