@@ -23,27 +23,6 @@ type SolaceContainer struct {
2323 settings options
2424}
2525
26- // waitForSolaceActive waits for the Solace broker to be fully active by checking the system log
27- func (s * SolaceContainer ) waitForSolaceActive (ctx context.Context ) error {
28- const maxAttempts = 60
29- const intervalSeconds = 1
30-
31- for attempt := 0 ; attempt < maxAttempts ; attempt ++ {
32- // Execute grep command to check for "Primary Virtual Router is now active" in system log
33- code , _ , err := s .Exec (ctx , []string {"grep" , "-R" , "Primary Virtual Router is now active" , "/usr/sw/jail/logs/system.log" })
34-
35- if err == nil && code == 0 {
36- // Found the message, broker is active
37- return nil
38- }
39-
40- // Wait before next attempt
41- time .Sleep (intervalSeconds * time .Second )
42- }
43-
44- return fmt .Errorf ("timeout waiting for Solace broker to become active after %d seconds" , maxAttempts )
45- }
46-
4726func Run (ctx context.Context , img string , opts ... testcontainers.ContainerCustomizer ) (* SolaceContainer , error ) {
4827 // Default to the standard Solace image if none provided
4928 settings := defaultOptions ()
@@ -117,7 +96,9 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
11796 ExposedPorts : settings .exposedPorts ,
11897 Env : settings .envVars ,
11998 Cmd : nil ,
120- WaitingFor : wait .ForHTTP ("/" ).WithPort ("8080/tcp" ).WithStartupTimeout (1 * time .Minute ),
99+ WaitingFor : wait .ForExec ([]string {"grep" , "-q" , "Primary Virtual Router is now active" , "/usr/sw/jail/logs/system.log" }).
100+ WithStartupTimeout (1 * time .Minute ).
101+ WithPollInterval (1 * time .Second ),
121102 HostConfigModifier : func (hc * container.HostConfig ) {
122103 hc .ShmSize = settings .shmSize
123104 },
@@ -137,11 +118,6 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
137118 }
138119 }
139120
140- // Wait for Solace broker to be fully active before configuring
141- if err := c .waitForSolaceActive (ctx ); err != nil {
142- return nil , fmt .Errorf ("failed waiting for Solace broker to become active: %w" , err )
143- }
144-
145121 // Copy and execute CLI script inside the container if it was generated
146122 if cliScript != "" {
147123 // Write the CLI script to a temp file
0 commit comments