diff --git a/src/Testcontainers.Pulsar/PulsarBuilder.cs b/src/Testcontainers.Pulsar/PulsarBuilder.cs
index a7d902c0b..4e84a2fb5 100644
--- a/src/Testcontainers.Pulsar/PulsarBuilder.cs
+++ b/src/Testcontainers.Pulsar/PulsarBuilder.cs
@@ -81,7 +81,26 @@ public PulsarBuilder WithFunctionsWorker(bool functionsWorkerEnabled = true)
public override PulsarContainer Build()
{
Validate();
- return new PulsarContainer(DockerResourceConfiguration);
+
+ var waitStrategy = Wait.ForUnixContainer();
+
+ waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
+ => request
+ .ForPath("/admin/v2/clusters")
+ .ForPort(PulsarWebServicePort)
+ .ForResponseMessageMatching(VerifyPulsarStatusAsync));
+
+ //To Do How do I access PulsarContainer.CreateAuthenticationTokenAsync so i can get the auth token?
+ // waitStrategy = waitStrategy.UntilHttpRequestIsSucceeded(request
+ // => request
+ // .ForPath("/admin/v2/clusters")
+ // .ForPort(PulsarWebServicePort)
+ // .ForResponseMessageMatching(VerifyPulsarStatusAsync)
+ // .WithHeader("Authorization", ));
+
+ var pulsarBuilder = WithWaitStrategy(waitStrategy);
+
+ return new PulsarContainer(pulsarBuilder.DockerResourceConfiguration);
}
///
@@ -94,10 +113,9 @@ protected override PulsarBuilder Init()
.WithFunctionsWorker(false)
.WithEntrypoint("/bin/sh", "-c")
.WithCommand("while [ ! -f " + StartupScriptFilePath + " ]; do sleep 0.1; done; " + StartupScriptFilePath)
- .WithWaitStrategy(Wait.ForUnixContainer().UntilCommandIsCompleted("bin/pulsar-admin", "clusters", "list"))
.WithStartupCallback((container, ct) => container.CopyStartupScriptAsync(ct));
}
-
+
///
protected override PulsarBuilder Clone(IResourceConfiguration resourceConfiguration)
{
@@ -115,4 +133,10 @@ protected override PulsarBuilder Merge(PulsarConfiguration oldValue, PulsarConfi
{
return new PulsarBuilder(new PulsarConfiguration(oldValue, newValue));
}
+
+ private async Task VerifyPulsarStatusAsync(System.Net.Http.HttpResponseMessage response)
+ {
+ var readAsStringAsync = await response.Content.ReadAsStringAsync();
+ return readAsStringAsync == "[\"standalone\"]";
+ }
}
\ No newline at end of file
diff --git a/src/Testcontainers.Pulsar/PulsarConfiguration.cs b/src/Testcontainers.Pulsar/PulsarConfiguration.cs
index 41abd0deb..f5bdb696d 100644
--- a/src/Testcontainers.Pulsar/PulsarConfiguration.cs
+++ b/src/Testcontainers.Pulsar/PulsarConfiguration.cs
@@ -60,12 +60,20 @@ public PulsarConfiguration(PulsarConfiguration oldValue, PulsarConfiguration new
}
///
- ///
+ /// Gets or sets the flag indicating whether authentication is enabled for the Pulsar container.
///
+ ///
+ /// By default, authentication is disabled.
+ /// Setting this property to true enables authentication for the Pulsar container.
+ ///
public bool? AuthenticationEnabled { get; }
///
- ///
+ /// Gets or sets a value indicating whether the functions worker is enabled.
///
+ ///
+ /// The functions worker is responsible for executing functions within Pulsar.
+ /// By default, the functions worker is not enabled.
+ ///
public bool? FunctionsWorkerEnabled { get; }
}
\ No newline at end of file