testcontainers-node icon indicating copy to clipboard operation
testcontainers-node copied to clipboard

Azurite: Support https/oauth configuration

Open ThatJoeMoore opened this issue 8 months ago • 1 comments

I'm needing to be able to use the cert/key and oauth options in Azurite (Yes, I know, life would be much simpler if I didn't have to 🤷 ).

It seems fairly straightforward to add the proper flags/options to the azurite module - it's testing it that seems difficult, since we likely want to make sure that we can call the thing with the expected certificates.

After doing some digging, I'm thinking that it could be done using the TlsSettings.ca property when constructing an Azure client, which will let us set up a self-signed CA and an associated cert that can we can use.

As for generating such a CA/cert for testing, after reviewing the various JS-native options, I'm pretty tempted to just generate the necessary keys/certs with an absurd expiration time (does 999,999 days - 2700+ years - seem long enough?) and embed them directly in the tests. It seems like this is the easiest way to go forward, since it means we won't have to count on a contributor having anything set up on their machine. Alternatively, the test-certs approach used in the kafka module could be easily adapted to generate what we need (really, just removing the keytool parts, since we just need what we can get with openssl).

I can likely have a PR up within a few days (depends on how hectic things get at work) that implements this, as long as we have an agreement on how to test it.

ThatJoeMoore avatar May 06 '25 05:05 ThatJoeMoore

Hi @ThatJoeMoore,

PR would be welcome.

We have a similar thing with Kafka, where we test TLS connectivity: https://github.com/testcontainers/testcontainers-node/tree/main/packages/modules/kafka/test-certs, and the test: https://github.com/testcontainers/testcontainers-node/blob/main/packages/modules/kafka/src/kafka-container.test.ts#L85-L121. A similar approach for Azurite would be great.

cristianrgreco avatar May 06 '25 11:05 cristianrgreco