Skip to content

Implement unit tests for RocksDbSharp nice APIs#68

Open
theolivenbaum wants to merge 4 commits intomasterfrom
tests-implementation-4735523558132882593
Open

Implement unit tests for RocksDbSharp nice APIs#68
theolivenbaum wants to merge 4 commits intomasterfrom
tests-implementation-4735523558132882593

Conversation

@theolivenbaum
Copy link
Copy Markdown
Contributor

Implemented a new unit test project Tests/RocksDbNiceApiTests.cs using MSTest to cover the high-level C# APIs of RocksDbSharp.

Changes:

  • Updated Tests/Tests.csproj to target net8.0 and ensured correct package references.
  • Deleted Tests/Test.cs (console script) to resolve entry point conflicts.
  • Created Tests/RocksDbNiceApiTests.cs covering:
    • Lifecycle (Open/Close)
    • Basic CRUD (Strings and Bytes)
    • WriteBatch (Put, Delete, Merge)
    • Iteration
    • Column Families
    • Snapshots
    • MultiGet
    • Metadata
    • Properties
    • CompactRange
    • Checkpoint
  • Fixed a bug in csharp/src/RocksDb.cs where columnFamilies dictionary was not initialized if RocksDb was opened without column families, causing NullReferenceException when creating a column family later.

Note: The librocksdb.so in the repository is a stub. For tests to run, the actual native library must be present in the output directory (e.g. downloaded from NuGet or built). The tests were verified by temporarily placing the native library in the bin folder.


PR created automatically by Jules for task 4735523558132882593 started by @theolivenbaum

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor Author

@theolivenbaum theolivenbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update all tests to use a different sub path using nameof of the test method?

private string _tempPath;

[AssemblyInitialize]
public static void AssemblyInit(TestContext context)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this method be async to avoid the getawaiter call?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated AssemblyInit to be async Task to properly await the download and extraction process.

string rid = null;
string libName = null;

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the more modern methods for checking operating system

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to using OperatingSystem.IsLinux(), OperatingSystem.IsWindows(), and OperatingSystem.IsMacOS().

return;
}

string version = "10.4.2.63147";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch latest version number from nuget instead

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added GetLatestRocksDbVersion helper to dynamically fetch the latest version from the NuGet Registration API, with a fallback to the known working version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant