Skip to content

Commit

Permalink
Merge branch 'main' into release-please--branches--main--components--…
Browse files Browse the repository at this point in the history
…spanner
  • Loading branch information
rahul2393 authored Feb 3, 2025
2 parents 18d48c4 + d7671ec commit 060ef0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spanner/request_id_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func init() {
if err != nil {
panic(err)
}
randIDForProcess = r64.String()
randIDForProcess = fmt.Sprintf("%016x", r64.Uint64())
}

// Please bump this version whenever this implementation
Expand Down
11 changes: 11 additions & 0 deletions spanner/request_id_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package spanner

import (
"context"
"encoding/hex"
"encoding/json"
"fmt"
"math"
Expand Down Expand Up @@ -1925,3 +1926,13 @@ func TestRequestIDHeader_SingleUseReadOnly_ExecuteStreamingSql_UnavailableDuring
t.Fatalf("RequestID streaming segments mismatch: got - want +\n%s", diff)
}
}

func TestRequestID_randIDForProcessIsHexadecimal(t *testing.T) {
decoded, err := hex.DecodeString(randIDForProcess)
if err != nil {
t.Fatal(err)
}
if len(decoded) == 0 {
t.Fatal("Expected a non-empty decoded result")
}
}

0 comments on commit 060ef0e

Please sign in to comment.