Skip to content

Commit

Permalink
update e2e
Browse files Browse the repository at this point in the history
Signed-off-by: kevindiu <[email protected]>
  • Loading branch information
kevindiu committed Oct 5, 2023
1 parent 39801af commit 65a31c6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
44 changes: 37 additions & 7 deletions tests/e2e/crud/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
true,
0,
false,
1,
func(t *testing.T, status int32, msg string) error {
t.Helper()
Expand Down Expand Up @@ -455,6 +457,8 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
false,
0,
false,
1,
func(t *testing.T, status int32, msg string) error {
t.Helper()
Expand Down Expand Up @@ -507,6 +511,8 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
false,
0,
false,
1,
operation.DefaultStatusValidator,
operation.ParseAndLogError,
Expand All @@ -523,6 +529,8 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
false,
0,
false,
1,
func(t *testing.T, status int32, msg string) error {
t.Helper()
Expand Down Expand Up @@ -560,6 +568,28 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
true,
0,
false,
1,
operation.DefaultStatusValidator,
operation.ParseAndLogError,
)
if err != nil {
t.Fatalf("an error occurred on #6: %s", err)
}

ts := time.Now().UnixNano()

// #7 run Update with the same vector as UpdateTimestampIfExists=true and check that it succeeds
err = op.UpdateWithParameters(
t,
ctx,
operation.Dataset{
Train: ds.Train[updateFrom : updateFrom+updateNum],
},
false,
ts,
true,
1,
operation.DefaultStatusValidator,
operation.ParseAndLogError,
Expand All @@ -568,7 +598,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred on #6: %s", err)
}

// #7 remove the vector in 6 with SkipStrictExistCheck=false and check that it succeeds
// #8 remove the vector in 6 with SkipStrictExistCheck=false and check that it succeeds
err = op.RemoveWithParameters(
t,
ctx,
Expand All @@ -583,7 +613,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred on #7: %s", err)
}

// #8 removed the vector of 6 with SkipStrictExistCheck=false and confirmed that it became NotFound
// #9 removed the vector of 6 with SkipStrictExistCheck=false and confirmed that it became NotFound
err = op.RemoveWithParameters(
t,
ctx,
Expand Down Expand Up @@ -619,7 +649,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred: %s", err)
}

// #9 remove vector 6 with SkipStrictExistCheck=true and check that it also becomes NotFound
// #10 remove vector 6 with SkipStrictExistCheck=true and check that it also becomes NotFound
err = op.RemoveWithParameters(
t,
ctx,
Expand Down Expand Up @@ -653,7 +683,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred: %s", err)
}

// #10 execute Upsert with SkipStrictExistCheck=false and check that it succeeds
// #11 execute Upsert with SkipStrictExistCheck=false and check that it succeeds
err = op.UpsertWithParameters(
t,
ctx,
Expand All @@ -669,7 +699,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred on #10: %s", err)
}

// #11 executed Upsert with SkipStrictExistCheck=false using the same vector as 10 and confirmed that AlreadyExists was returned
// #12 executed Upsert with SkipStrictExistCheck=false using the same vector as 10 and confirmed that AlreadyExists was returned
err = op.UpsertWithParameters(
t,
ctx,
Expand Down Expand Up @@ -706,7 +736,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred: %s", err)
}

// #12 executed SkipStrictExistCheck=false using a different vector than 10 for Upsert and confirmed that it succeeded
// #13 executed SkipStrictExistCheck=false using a different vector than 10 for Upsert and confirmed that it succeeded
err = op.UpsertWithParameters(
t,
ctx,
Expand All @@ -722,7 +752,7 @@ func TestE2ECRUDWithSkipStrictExistCheck(t *testing.T) {
t.Fatalf("an error occurred on #12: %s", err)
}

// #13 executed SkipStrictExistCheck=true using the same vector as Upsert 12 and confirmed that it succeeded
// #14 executed SkipStrictExistCheck=true using the same vector as Upsert 12 and confirmed that it succeeded
err = op.UpsertWithParameters(
t,
ctx,
Expand Down
8 changes: 7 additions & 1 deletion tests/e2e/operation/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ func (c *client) Update(t *testing.T, ctx context.Context, ds Dataset) error {
ctx,
ds,
false,
0,
false,
1,
DefaultStatusValidator,
ParseAndLogError,
Expand All @@ -733,6 +735,8 @@ func (c *client) UpdateWithParameters(
ctx context.Context,
ds Dataset,
skipStrictExistCheck bool,
ts int64,
updateTs bool,
offset int,
svalidator StatusValidator,
evalidator ErrorValidator,
Expand Down Expand Up @@ -804,7 +808,9 @@ func (c *client) UpdateWithParameters(
Vector: append(v[offset:], v[:offset]...),
},
Config: &payload.Update_Config{
SkipStrictExistCheck: skipStrictExistCheck,
SkipStrictExistCheck: skipStrictExistCheck,
Timestamp: ts,
UpdateTimestampIfExists: updateTs,
},
})
if err != nil {
Expand Down

0 comments on commit 65a31c6

Please sign in to comment.