@@ -2,8 +2,10 @@ package integration_test
22
33import (
44 "context"
5+ "crypto/tls"
56 "fmt"
67 "net"
8+ "net/http"
79 "os"
810 "path/filepath"
911 "strconv"
@@ -158,7 +160,7 @@ func TestStartCommandSetsUpContainerCorrectly(t *testing.T) {
158160
159161 t .Run ("environment variables" , func (t * testing.T ) {
160162 envVars := containerEnvToMap (inspect .Config .Env )
161- assert .Equal (t , ":4566" , envVars ["GATEWAY_LISTEN" ])
163+ assert .Equal (t , ":4566,:443 " , envVars ["GATEWAY_LISTEN" ])
162164 assert .Equal (t , containerName , envVars ["MAIN_CONTAINER_NAME" ])
163165 assert .NotEmpty (t , envVars ["LOCALSTACK_AUTH_TOKEN" ])
164166 })
@@ -191,10 +193,37 @@ func TestStartCommandSetsUpContainerCorrectly(t *testing.T) {
191193 assert .Equal (t , "4566" , mainBindings [0 ].HostPort )
192194 })
193195
196+ t .Run ("https port" , func (t * testing.T ) {
197+ httpsBindings := inspect .HostConfig .PortBindings [nat .Port ("443/tcp" )]
198+ require .NotEmpty (t , httpsBindings , "port 443/tcp should be bound" )
199+ assert .Equal (t , "443" , httpsBindings [0 ].HostPort )
200+ })
201+
194202 t .Run ("volume mount" , func (t * testing.T ) {
195203 assert .True (t , hasBindTarget (inspect .HostConfig .Binds , "/var/lib/localstack" ),
196204 "expected volume bind mount to /var/lib/localstack, got: %v" , inspect .HostConfig .Binds )
197205 })
206+
207+ t .Run ("http health endpoint" , func (t * testing.T ) {
208+ resp , err := http .Get ("http://localhost.localstack.cloud:4566/_localstack/health" )
209+ require .NoError (t , err )
210+ defer resp .Body .Close ()
211+ assert .Equal (t , http .StatusOK , resp .StatusCode )
212+ })
213+
214+ t .Run ("https health endpoint" , func (t * testing.T ) {
215+ // LS certificate is not in system trust store
216+ // But cert validity is out of scope here: use InsecureSkipVerify
217+ client := & http.Client {
218+ Transport : & http.Transport {
219+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
220+ },
221+ }
222+ resp , err := client .Get ("https://localhost.localstack.cloud/_localstack/health" )
223+ require .NoError (t , err )
224+ defer resp .Body .Close ()
225+ assert .Equal (t , http .StatusOK , resp .StatusCode )
226+ })
198227}
199228
200229// containerEnvToMap converts a Docker container's []string env to a map.
0 commit comments