-
Notifications
You must be signed in to change notification settings - Fork 139
test: add write operations test suite #497
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
tests/write_operations_test.go
Outdated
|
|
||
| // Second should succeed since conflict detection may not be fully implemented yet | ||
| // In a full implementation, this would fail due to conflict | ||
| _, err2 = tx2.Commit(s.ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better s.T().Skip("not yet implemented")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if i skip, i would skip the whole test, i think currently the comments and logs explain, wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only change between log and skip is that skip test is not GREEN in CI (it's yellow), so it's more honest.
tests/write_operations_test.go
Outdated
| s.writeParquet(fs, consolidatedPath, replacementData) | ||
|
|
||
| // For this test, we'll demonstrate overwrite by creating a new file | ||
| // and replacing specific known files rather than discovering them dynamically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need an assertion of this row
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you kindly suggest a change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think what you can check that lists of files in snapshot differ before and after writes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 3500678
tests/write_operations_test.go
Outdated
| // manifests to include the delete files, which is a more complex operation | ||
| // that would need transaction-level support for delete file management | ||
|
|
||
| s.T().Log("Position delete file structure verified - integration with table scanning requires manifest updates") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.T().Skip()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iiuc this is the end of the test .. u mean to skip this test
s.Run("ApplyPositionDeletes", func() {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted 👍🏽
tests/write_operations_test.go
Outdated
| // 3. The current scanner has error handling for equality deletes but | ||
| // returns "not yet supported" for actual application | ||
|
|
||
| s.T().Log("Equality delete file structure verified - scanner integration shows 'not yet supported'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto ? skip whole test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm think so, all other aspect in this tests already covered in tests above, and this skip would be vocal here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted 👍🏽
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
|
Many of these types of tests already exist in table/table_test.go, can we move these tests there instead? Go doesn't really have a convention of a "tests" directory like this, the tests should be in the same package as the code being tested. |
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
check now 👍🏽 |
e833d44 to
1bdc32e
Compare
|
i fixed the linter issues, can u re-run plz cc @zeroshade |
|
i ran |
table/table_test.go
Outdated
| func TestRewriteFiles(t *testing.T) { | ||
| suite.Run(t, &WriteOperationsTestSuite{}) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, this is identical to TestWriteOptions, you don't need both of them
| } | ||
|
|
||
| func (s *WriteOperationsTestSuite) TestRewriteFiles() { | ||
| s.Run("RewriteDataFiles", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need this, the function itself does this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant get it, this is a sub-test,
which function u mean ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use the test suite pattern, having a function TestRewriteDataFiles will create the subtest for you. You don't need to manually add s.Run here. Since there's no commonality between the subtests it would be better for them to be separate functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
| s.T().Log("EXPECTED: In full implementation, should only contain consolidated file") | ||
| }) | ||
|
|
||
| s.Run("RewriteWithConflictDetection", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a separate function named TestRewriteWithConflictDetection instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
table/table_test.go
Outdated
| } | ||
|
|
||
| func (s *WriteOperationsTestSuite) TestOverwriteFiles() { | ||
| s.Run("OverwriteByPartition", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make a function TestOverwriteByPartition instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
| s.T().Log("EXPECTED: In partition overwrite, should only contain new partition data") | ||
| }) | ||
|
|
||
| s.Run("OverwriteWithFilter", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing, make this a separate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
| } | ||
|
|
||
| func (s *WriteOperationsTestSuite) TestPositionDeletes() { | ||
| s.Run("WritePositionDeleteFiles", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you get the idea, not going to repeat this comment over and over 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
table/table_test.go
Outdated
|
|
||
| require.NoError(t, cat.CreateNamespace(t.Context(), table.Identifier{"testing"}, nil)) | ||
| tbl, err := cat.CreateTable(t.Context(), table.Identifier{"testing", "nullable_struct_required_field"}, sc, | ||
| require.NoError(t, cat.CreateNamespace(context.Background(), table.Identifier{"testing"}, nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make a variable ctx := context.Background() and just reuse that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍🏽
1bdc32e to
b25c5a1
Compare
|
@zeroshade ptal :) |
|
@Elbehery see my comments :) |
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
b25c5a1 to
a05303c
Compare
This PR adds test suite for write operations.
Inspired by TestRewriteFiles
cc @laskoviymishka