@@ -173,31 +173,32 @@ protected void RunE2ETest(Action<E2ETestContext> test, E2ETestOptions options =
173173 string newLine = serverOutput . Current ;
174174 output . WriteLine ( newLine ) ;
175175
176- if ( newLine . StartsWith ( "Now listening on: http://" ) )
176+ if ( newLine . Contains ( "Now listening on: http://" ) )
177177 {
178+ // Handle both IPv4 (http://localhost:5000) and IPv6 (http://[::]:80) formats
178179 int internalPortNumber = int . Parse ( Regex . Replace ( newLine , @".*http://[^\s]+:(\d+)" , "$1" ) ) ;
179180 // For Docker, map internal port 80 to external port 5000
180181 int portNumber = ( binary == "docker" && internalPortNumber == 80 ) ? 5000 : internalPortNumber ;
181182 baseUrl = new Uri ( $ "http://localhost:{ portNumber } { options . TestPath ?? options . BasePath ?? "" } ") ;
182183 }
183184
184- if ( newLine . StartsWith ( "SMTP Server is listening on port" ) )
185+ if ( newLine . Contains ( "SMTP Server is listening on port" ) )
185186 {
186- int internalSmtpPort = int . Parse ( Regex . Replace ( newLine , @"SMTP Server is listening on port (\d+).*" , "$1" ) ) ;
187+ int internalSmtpPort = int . Parse ( Regex . Replace ( newLine , @".* SMTP Server is listening on port (\d+).*" , "$1" ) ) ;
187188 // For Docker, map internal port 25 to external port 2525
188189 smtpPortNumber = ( binary == "docker" && internalSmtpPort == 25 ) ? 2525 : internalSmtpPort ;
189190 }
190191
191- if ( newLine . StartsWith ( "IMAP Server is listening on port" ) )
192+ if ( newLine . Contains ( "IMAP Server is listening on port" ) )
192193 {
193- int internalImapPort = int . Parse ( Regex . Replace ( newLine , @"IMAP Server is listening on port (\d+).*" , "$1" ) ) ;
194+ int internalImapPort = int . Parse ( Regex . Replace ( newLine , @".* IMAP Server is listening on port (\d+).*" , "$1" ) ) ;
194195 // For Docker, map internal port 143 to external port 1143
195196 imapPortNumber = ( binary == "docker" && internalImapPort == 143 ) ? 1143 : internalImapPort ;
196197 }
197198
198- if ( newLine . StartsWith ( "POP3 Server is listening on port" ) )
199+ if ( newLine . Contains ( "POP3 Server is listening on port" ) )
199200 {
200- int internalPop3Port = int . Parse ( Regex . Replace ( newLine , @"POP3 Server is listening on port (\d+).*" , "$1" ) ) ;
201+ int internalPop3Port = int . Parse ( Regex . Replace ( newLine , @".* POP3 Server is listening on port (\d+).*" , "$1" ) ) ;
201202 // For Docker, map internal port 110 to external port 1100
202203 pop3PortNumber = ( binary == "docker" && internalPop3Port == 110 ) ? 1100 : internalPop3Port ;
203204 // Try to parse the address from the same line (e.g. "POP3 Server is listening on port 53333 (::)")
@@ -220,7 +221,7 @@ protected void RunE2ETest(Action<E2ETestContext> test, E2ETestOptions options =
220221 }
221222 }
222223
223- if ( newLine . StartsWith ( "Application started. Press Ctrl+C to shut down." ) )
224+ if ( newLine . Contains ( "Application started. Press Ctrl+C to shut down." ) )
224225 {
225226 throw new Exception ( $@ "Startup completed but did not catch variables from startup output:
226227 baseUrl:{ baseUrl }
0 commit comments