Skip to content

Commit f898b49

Browse files
committed
Merge branch 'main' into spanner-lib
2 parents 312ff67 + 3aa5ca2 commit f898b49

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

aborted_transactions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ func TestBatchUpdateAbortedWithError(t *testing.T) {
919919
t.Fatalf("error code mismatch\nGot: %v\nWant: %v", spanner.ErrCode(err), codes.NotFound)
920920
}
921921

922-
// Abort the transaction. The internal retry should succeed as teh same error
922+
// Abort the transaction. The internal retry should succeed as the same error
923923
// and the same row count is returned during the retry.
924924
server.TestSpanner.PutExecutionTime(testutil.MethodCommitTransaction, testutil.SimulatedExecutionTime{
925925
Errors: []error{status.Error(codes.Aborted, "Aborted")},

emulator_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func createInstance(projectId, instanceId string) error {
6464
},
6565
})
6666
if err != nil {
67-
return fmt.Errorf("could not create instance %s: %v", fmt.Sprintf("projects/%s/instances/%s", projectId, instanceId), err)
67+
return fmt.Errorf("could not create instance %s: %w", fmt.Sprintf("projects/%s/instances/%s", projectId, instanceId), err)
6868
}
6969
// Wait for the instance creation to finish.
7070
if _, err := op.Wait(ctx); err != nil {

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require (
1313
github.com/google/uuid v1.6.0
1414
github.com/googleapis/gax-go/v2 v2.14.2
1515
github.com/hashicorp/golang-lru v0.5.1
16-
github.com/hashicorp/golang-lru/v2 v2.0.7
1716
google.golang.org/api v0.236.0
1817
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822
1918
google.golang.org/grpc v1.73.0

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU
830830
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
831831
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
832832
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
833-
github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4=
834-
github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
835-
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
836833
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
837834
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
838835
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=

integration_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,34 @@ func skipIfEmulator(t *testing.T, msg string) {
270270
}
271271
}
272272

273+
func TestAutoConfigEmulator(t *testing.T) {
274+
skipIfShort(t)
275+
if !runsOnEmulator() {
276+
t.Skip("autoConfigEmulator=true only works when connected to the emulator")
277+
}
278+
t.Parallel()
279+
280+
ctx := context.Background()
281+
for range 2 {
282+
db, err := sql.Open("spanner", "projects/emulator-project/instances/test-instance/databases/test-database;autoConfigEmulator=true")
283+
if err != nil {
284+
t.Fatalf("could not connect to emulator: %v", err)
285+
}
286+
row := db.QueryRowContext(ctx, "select 1")
287+
if row.Err() != nil {
288+
t.Fatalf("could not execute select 1: %v", row.Err())
289+
}
290+
var v int64
291+
if err := row.Scan(&v); err != nil {
292+
t.Fatalf("could not scan value from select 1: %v", err)
293+
}
294+
if g, w := v, int64(1); g != w {
295+
t.Fatalf("value mismatch:\n Got %d\nWant %d", g, w)
296+
}
297+
_ = db.Close()
298+
}
299+
}
300+
273301
func TestQueryContext(t *testing.T) {
274302
skipIfShort(t)
275303
t.Parallel()

statement_parser.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,14 @@ func (p *statementParser) calculateFindParamsResult(sql string) (string, []strin
712712
for parser.pos < len(parser.sql) {
713713
startPos := parser.pos
714714
parser.skipWhitespacesAndComments()
715-
parsedSQL.WriteString(string(parser.sql[startPos:parser.pos]))
715+
parsedSQL.Write(parser.sql[startPos:parser.pos])
716716
if parser.pos >= len(parser.sql) {
717717
break
718718
}
719719
if parser.isMultibyte() {
720720
startPos = parser.pos
721721
parser.nextChar()
722-
parsedSQL.WriteString(string(parser.sql[startPos:parser.pos]))
722+
parsedSQL.Write(parser.sql[startPos:parser.pos])
723723
continue
724724
}
725725
c := parser.sql[parser.pos]
@@ -772,7 +772,7 @@ func (p *statementParser) calculateFindParamsResult(sql string) (string, []strin
772772
if err != nil {
773773
return sql, nil, err
774774
}
775-
parsedSQL.WriteString(string(parser.sql[startPos:newPos]))
775+
parsedSQL.Write(parser.sql[startPos:newPos])
776776
parser.pos = newPos
777777
}
778778
}

0 commit comments

Comments
 (0)