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

chore(spanner): fix proto schema naming in tests #10194

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 16 additions & 16 deletions spanner/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2271,19 +2271,19 @@ func TestIntegration_BasicTypes_ProtoColumns(t *testing.T) {
defer cancel()
stmts := []string{
`CREATE PROTO BUNDLE (
spanner.examples.music.SingerInfo,
spanner.examples.music.Genre,
examples.spanner.music.SingerInfo,
examples.spanner.music.Genre,
)`,
`CREATE TABLE Types (
RowID INT64 NOT NULL,
Int64a INT64,
Bytes BYTES(MAX),
Int64Array ARRAY<INT64>,
BytesArray ARRAY<BYTES(MAX)>,
ProtoMessage spanner.examples.music.SingerInfo,
ProtoEnum spanner.examples.music.Genre,
ProtoMessageArray ARRAY<spanner.examples.music.SingerInfo>,
ProtoEnumArray ARRAY<spanner.examples.music.Genre>,
ProtoMessage examples.spanner.music.SingerInfo,
ProtoEnum examples.spanner.music.Genre,
ProtoMessageArray ARRAY<examples.spanner.music.SingerInfo>,
ProtoEnumArray ARRAY<examples.spanner.music.Genre>,
) PRIMARY KEY (RowID)`,
}

Expand Down Expand Up @@ -2512,19 +2512,19 @@ func TestIntegration_BasicTypes_ProtoColumns_Errors(t *testing.T) {
defer cancel()
stmts := []string{
`CREATE PROTO BUNDLE (
spanner.examples.music.SingerInfo,
spanner.examples.music.Genre,
examples.spanner.music.SingerInfo,
examples.spanner.music.Genre,
)`,
`CREATE TABLE Types (
RowID INT64 NOT NULL,
Int64a INT64,
Bytes BYTES(MAX),
Int64Array ARRAY<INT64>,
BytesArray ARRAY<BYTES(MAX)>,
ProtoMessage spanner.examples.music.SingerInfo,
ProtoEnum spanner.examples.music.Genre,
ProtoMessageArray ARRAY<spanner.examples.music.SingerInfo>,
ProtoEnumArray ARRAY<spanner.examples.music.Genre>,
ProtoMessage examples.spanner.music.SingerInfo,
ProtoEnum examples.spanner.music.Genre,
ProtoMessageArray ARRAY<examples.spanner.music.SingerInfo>,
ProtoEnumArray ARRAY<examples.spanner.music.Genre>,
) PRIMARY KEY (RowID)`,
}
protoDescriptor := readProtoDescriptorFile()
Expand Down Expand Up @@ -2607,15 +2607,15 @@ func TestIntegration_ProtoColumns_DML_ParameterizedQueries_Pk_Indexes(t *testing
defer cancel()
stmts := []string{
`CREATE PROTO BUNDLE (
spanner.examples.music.SingerInfo,
spanner.examples.music.Genre,
examples.spanner.music.SingerInfo,
examples.spanner.music.Genre,
)`,
`CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo spanner.examples.music.SingerInfo,
SingerGenre spanner.examples.music.Genre,
SingerInfo examples.spanner.music.SingerInfo,
SingerGenre examples.spanner.music.Genre,
SingerNationality STRING(1024) AS (SingerInfo.nationality) STORED,
) PRIMARY KEY (SingerNationality, SingerGenre)`,
`CREATE INDEX SingerByNationalityAndGenre ON Singers(SingerNationality, SingerGenre) STORING (SingerId, FirstName, LastName)`,
Expand Down
5 changes: 5 additions & 0 deletions spanner/testdata/protos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### To generate singer.pb.go and descriptors.pb file from singer.proto using `protoc`
```shell
cd spanner/testdata
protoc --proto_path=protos/ --include_imports --descriptor_set_out=protos/descriptors.pb --go_out=protos/ protos/singer.proto
```
Binary file modified spanner/testdata/protos/descriptors.pb
Binary file not shown.
138 changes: 70 additions & 68 deletions spanner/testdata/protos/singer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions spanner/testdata/protos/singer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ limitations under the License.

syntax = "proto2";

package spanner.examples.music;
option go_package = "./protos";
package examples.spanner.music;
option go_package = "./";

message SingerInfo {
optional int64 singer_id = 1;
Expand Down
8 changes: 4 additions & 4 deletions spanner/value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ func TestEncodeValue(t *testing.T) {
Nationality: proto.String("Country2"),
Genre: &singer2ProtoEnum,
}
protoMessagefqn := "spanner.examples.music.SingerInfo"
protoEnumfqn := "spanner.examples.music.Genre"
protoMessagefqn := "examples.spanner.music.SingerInfo"
protoEnumfqn := "examples.spanner.music.Genre"

var (
tString = stringType()
Expand Down Expand Up @@ -1536,8 +1536,8 @@ func TestDecodeValue(t *testing.T) {
Nationality: proto.String("Country2"),
Genre: &singer2ProtoEnum,
}
protoMessagefqn := "spanner.examples.music.SingerInfo"
protoEnumfqn := "spanner.examples.music.Genre"
protoMessagefqn := "examples.spanner.music.SingerInfo"
protoEnumfqn := "examples.spanner.music.Genre"

for _, test := range []struct {
desc string
Expand Down
Loading