Skip to content

Commit

Permalink
test(bigquery): better names for nested reused message
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarowolfx committed Sep 15, 2023
1 parent e0e2f90 commit dfb8345
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions bigquery/storage/managedwriter/adapt/protoconversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,53 +365,53 @@ func TestSchemaToProtoConversion(t *testing.T) {
bq: &storagepb.TableSchema{
Fields: []*storagepb.TableFieldSchema{
{
Name: "bartest1",
Name: "reused_inner_struct",
Type: storagepb.TableFieldSchema_STRUCT,
Mode: storagepb.TableFieldSchema_REQUIRED,
Fields: []*storagepb.TableFieldSchema{
{
Name: "barid",
Name: "leaf",
Type: storagepb.TableFieldSchema_STRING,
Mode: storagepb.TableFieldSchema_REQUIRED,
},
},
},
{
Name: "fullprofile",
Name: "outer_struct",
Type: storagepb.TableFieldSchema_STRUCT,
Mode: storagepb.TableFieldSchema_REQUIRED,
Fields: []*storagepb.TableFieldSchema{
{
Name: "biztest1",
Name: "another_inner_struct",
Type: storagepb.TableFieldSchema_STRUCT,
Mode: storagepb.TableFieldSchema_REQUIRED,
Fields: []*storagepb.TableFieldSchema{
{
Name: "bizid",
Name: "another_leaf",
Type: storagepb.TableFieldSchema_STRING,
Mode: storagepb.TableFieldSchema_REQUIRED,
},
},
},
{
Name: "bartest2",
Name: "reused_inner_struct_one",
Type: storagepb.TableFieldSchema_STRUCT,
Mode: storagepb.TableFieldSchema_REQUIRED,
Fields: []*storagepb.TableFieldSchema{
{
Name: "barid",
Name: "leaf",
Type: storagepb.TableFieldSchema_STRING,
Mode: storagepb.TableFieldSchema_REQUIRED,
},
},
},
{
Name: "bartest3",
Name: "reused_inner_struct_two",
Type: storagepb.TableFieldSchema_STRUCT,
Mode: storagepb.TableFieldSchema_REQUIRED,
Fields: []*storagepb.TableFieldSchema{
{
Name: "barid",
Name: "leaf",
Type: storagepb.TableFieldSchema_STRING,
Mode: storagepb.TableFieldSchema_REQUIRED,
},
Expand All @@ -425,17 +425,17 @@ func TestSchemaToProtoConversion(t *testing.T) {
Name: proto.String("root"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("bartest1"),
Name: proto.String("reused_inner_struct"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".root__bartest1"),
TypeName: proto.String(".root__reused_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
{
Name: proto.String("fullprofile"),
Name: proto.String("outer_struct"),
Number: proto.Int32(2),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".root__fullprofile"),
TypeName: proto.String(".root__outer_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
},
Expand All @@ -444,65 +444,65 @@ func TestSchemaToProtoConversion(t *testing.T) {
Name: proto.String("root"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("bartest1"),
Name: proto.String("reused_inner_struct"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String("root__bartest1"),
TypeName: proto.String("root__reused_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
{
Name: proto.String("fullprofile"),
Name: proto.String("outer_struct"),
Number: proto.Int32(2),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String("root__fullprofile"),
TypeName: proto.String("root__outer_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
},
NestedType: []*descriptorpb.DescriptorProto{
{
Name: proto.String("root__bartest1"),
Name: proto.String("root__reused_inner_struct"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("barid"),
Name: proto.String("leaf"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
},
},
{
Name: proto.String("root__fullprofile__biztest1"),
Name: proto.String("root__outer_struct__another_inner_struct"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("bizid"),
Name: proto.String("another_leaf"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
},
},
{
Name: proto.String("root__fullprofile"),
Name: proto.String("root__outer_struct"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("biztest1"),
Name: proto.String("another_inner_struct"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String("root__fullprofile__biztest1"),
TypeName: proto.String("root__outer_struct__another_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
{
Name: proto.String("bartest2"),
Name: proto.String("reused_inner_struct_one"),
Number: proto.Int32(2),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String("root__bartest1"),
TypeName: proto.String("root__reused_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
{
Name: proto.String("bartest3"),
Name: proto.String("reused_inner_struct_two"),
Number: proto.Int32(3),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String("root__bartest1"),
TypeName: proto.String("root__reused_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_REQUIRED.Enum(),
},
},
Expand All @@ -513,17 +513,17 @@ func TestSchemaToProtoConversion(t *testing.T) {
Name: proto.String("root"),
Field: []*descriptorpb.FieldDescriptorProto{
{
Name: proto.String("bartest1"),
Name: proto.String("reused_inner_struct"),
Number: proto.Int32(1),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".root__bartest1"),
TypeName: proto.String(".root__reused_inner_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
},
{
Name: proto.String("fullprofile"),
Name: proto.String("outer_struct"),
Number: proto.Int32(2),
Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(),
TypeName: proto.String(".root__fullprofile"),
TypeName: proto.String(".root__outer_struct"),
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
},
},
Expand Down

0 comments on commit dfb8345

Please sign in to comment.