UniStore: Use epoch with microsecond resolution as RV (#92638)
* Use epoch with microsecond resolution as RV * fix backend tests * Add solution for when the clock goes back * Add solution for when the clock goes back * generate mocks * go lint * remove comment * Use Greatest instead of max in msyql and postgres * update tests * Update pkg/storage/unified/sql/sqltemplate/dialect_sqlite.go Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com> * cast to bigint * add additional round trip * increment the RV using 2 sql round trips instead of 3 * cleanup comments * cast unix timestamp to integer * fix postgres query * remove old increment test data * remove greatest * cast unix_timestamp to signed * Use statement_timestamp instead of clock_timestamp --------- Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
This commit is contained in:
co-authored by
Diego Augusto Molina
parent
0bd3ad1d5a
commit
d999b415df
@@ -52,7 +52,12 @@ func TestUnifiedStorageQueries(t *testing.T) {
|
||||
Data: &sqlResourceRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
WriteEvent: resource.WriteEvent{
|
||||
Key: &resource.ResourceKey{},
|
||||
Key: &resource.ResourceKey{
|
||||
Namespace: "nn",
|
||||
Group: "gg",
|
||||
Resource: "rr",
|
||||
Name: "name",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -63,7 +68,12 @@ func TestUnifiedStorageQueries(t *testing.T) {
|
||||
Data: &sqlResourceReadRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
Request: &resource.ReadRequest{
|
||||
Key: &resource.ResourceKey{},
|
||||
Key: &resource.ResourceKey{
|
||||
Namespace: "nn",
|
||||
Group: "gg",
|
||||
Resource: "rr",
|
||||
Name: "name",
|
||||
},
|
||||
},
|
||||
readResponse: new(readResponse),
|
||||
},
|
||||
@@ -155,7 +165,12 @@ func TestUnifiedStorageQueries(t *testing.T) {
|
||||
Data: &sqlResourceRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
WriteEvent: resource.WriteEvent{
|
||||
Key: &resource.ResourceKey{},
|
||||
Key: &resource.ResourceKey{
|
||||
Namespace: "nn",
|
||||
Group: "gg",
|
||||
Resource: "rr",
|
||||
Name: "name",
|
||||
},
|
||||
PreviousRV: 1234,
|
||||
},
|
||||
},
|
||||
@@ -165,22 +180,24 @@ func TestUnifiedStorageQueries(t *testing.T) {
|
||||
sqlResourceVersionGet: {
|
||||
{
|
||||
Name: "single path",
|
||||
Data: &sqlResourceVersionRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
resourceVersion: new(resourceVersion),
|
||||
ReadOnly: false,
|
||||
Data: &sqlResourceVersionGetRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
Resource: "resource",
|
||||
Group: "group",
|
||||
Response: new(resourceVersionResponse),
|
||||
ReadOnly: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
sqlResourceVersionInc: {
|
||||
sqlResourceVersionUpdate: {
|
||||
{
|
||||
Name: "increment resource version",
|
||||
Data: &sqlResourceVersionRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
resourceVersion: &resourceVersion{
|
||||
ResourceVersion: 123,
|
||||
},
|
||||
Data: &sqlResourceVersionUpsertRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
Resource: "resource",
|
||||
Group: "group",
|
||||
ResourceVersion: int64(12354),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -188,8 +205,9 @@ func TestUnifiedStorageQueries(t *testing.T) {
|
||||
sqlResourceVersionInsert: {
|
||||
{
|
||||
Name: "single path",
|
||||
Data: &sqlResourceVersionRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
Data: &sqlResourceVersionUpsertRequest{
|
||||
SQLTemplate: mocks.NewTestingSQLTemplate(),
|
||||
ResourceVersion: int64(12354),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user