Skip to content
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

Add Qdrant container #994

Closed
wants to merge 3 commits into from
Closed

Conversation

russcam
Copy link

@russcam russcam commented Sep 10, 2023

Closes #992

What does this PR do?

This commit adds a qdrant container to the list of supported Testcontainers.

The qdrant container allows configuration of:

Why is it important?

Provides a qdrant test container for folks that need it

Related issues

#992

How to test this PR

Run tests in Testcontainers.Qdrant.Tests

This commit adds a qdrant container to the list of supported
Testcontainers.

The qdrant container allows configuration of:

- an API key to authenticate to Qdrant
- an x509 certificate used to secure communication to Qdrant with
  Transport Layer Security
- a custom configuration file. See
  https://qdrant.tech/documentation/guides/configuration/

Closes testcontainers#992
@netlify
Copy link

netlify bot commented Sep 10, 2023

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 6df3572
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/64fdc3a5e375d8000710ae2e
😎 Deploy Preview https://deploy-preview-994--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Qdrant uses rustls for TLS, which does not accept IPv4 or IPv6 addresses as the hostname in SNI, adhering
to RFC 6066: https://www.rfc-editor.org/rfc/rfc6066#page-7

Sending an IPv4 or IPv6 address as the hostname in SNI causes the handshake to be rejected and
qdrant to log

WARN rustls::msgs::handshake: Illegal SNI hostname received "127.0.0.1"

By default, .NET on linux sends the DNS name in the URI in Server Name Indication (SNI),
irrespective of whether it's an IP address or not. In order to resolve this, a custom
Host request header is added, per

dotnet/runtime#20876 (comment)
@russcam
Copy link
Author

russcam commented Sep 13, 2023

This is ready to review @HofmeisterAn

Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

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

This is ready to review @HofmeisterAn

Thank you for your pull request. I've already seen the PR but haven't had the time to thoroughly review it yet. Spare time is limited 😅.

Most of it looks good! I just have a few minor suggestions and improvements.

In general, we don't expose an API for every configuration (e.g., environment variable) if the developer can configure it themselves through the generic API (it doesn't require in-depth knowledge or isn't crucial for starting a basic container). However, I'm okay with the exposed APIs, but I would like to clean up some parts related to the TLS implementation if needed. I'll need to take a closer look at it (I will look into it by end of this week).

Comment on lines +1 to +4
using System.IO;
using System.Security.Cryptography.X509Certificates;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move the usings (other classes too) into the global Usings.cs file.

/// </summary>
/// <param name="configurationFilePath">The path to the configuration file</param>
public QdrantBuilder WithConfigFile(string configurationFilePath) =>
Merge(DockerResourceConfiguration, new QdrantConfiguration(configurationFilePath: configurationFilePath))
Copy link
Collaborator

@HofmeisterAn HofmeisterAn Sep 13, 2023

Choose a reason for hiding this comment

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

If we do not require the ConfigurationFilePath property, along with the other configuration properties, at some time later, such as within the Qdrant container instance, then there is no need to keep and store the value. I think we can remove those properties from QdrantConfiguration

/// <param name="configurationFilePath">The path to the configuration file</param>
public QdrantBuilder WithConfigFile(string configurationFilePath) =>
Merge(DockerResourceConfiguration, new QdrantConfiguration(configurationFilePath: configurationFilePath))
.WithBindMount(configurationFilePath, QdrantLocalConfigurationFilePath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
.WithBindMount(configurationFilePath, QdrantLocalConfigurationFilePath);
.WithResourceMapping(configurationFilePath, QdrantLocalConfigurationFilePath);

/// private key.
/// </summary>
/// <param name="certificate">A certificate containing a private key</param>
public QdrantBuilder WithCertificate(X509Certificate2 certificate)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we not expect the developer to provide valid cert.pem and key.pem files? This way, we can avoid dealing with all the certificate-related issues and Bouncy Castle.

Comment on lines +8 to +11
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1"/>
<PackageReference Include="coverlet.collector" Version="3.2.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"/>
<PackageReference Include="xunit" Version="2.4.2"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1"/>
<PackageReference Include="coverlet.collector" Version="3.2.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"/>
<PackageReference Include="xunit" Version="2.4.2"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"/>
<PackageReference Include="xunit" Version="2.5.0"/>

@HofmeisterAn
Copy link
Collaborator

This pull request has been inactive for some time. I will close it for now. If you wish to continue working on it, please feel free to reopen it.

@russcam
Copy link
Author

russcam commented Mar 30, 2024

@HofmeisterAn please can we reopen this PR; I've rebased from develop and updated following PR feedback. If it's easier, I can always open a new PR, but I don't have the ability to reopen this one

@HofmeisterAn
Copy link
Collaborator

@HofmeisterAn please can we reopen this PR; I've rebased from develop and updated following PR feedback. If it's easier, I can always open a new PR, but I don't have the ability to reopen this one

I am sorry, I cannot reopen it either, it says:

The qdrant-container branch was force-pushed or recreated.

You probably need to create a new PR - sorry.

@russcam
Copy link
Author

russcam commented Apr 2, 2024

Superseded by #1149

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.

[Feature]: Add Qdrant test container
2 participants