diff --git a/listen_test.go b/listen_test.go index 313b667cc3..032f7d32c4 100644 --- a/listen_test.go +++ b/listen_test.go @@ -233,6 +233,16 @@ func Test_Listen_Prefork(t *testing.T) { app := New() + require.NoError(t, app.Listen(":99999", ListenConfig{DisableStartupMessage: true, EnablePrefork: true})) +} + +// go test -run Test_Listen_TLSMinVersion +func Test_Listen_TLSMinVersion(t *testing.T) { + testPreforkMaster = true + + app := New() + + // Invalid TLSMinVersion require.Panics(t, func() { _ = app.Listen(":443", ListenConfig{TLSMinVersion: tls.VersionTLS10}) //nolint:errcheck // ignore error }) @@ -240,20 +250,27 @@ func Test_Listen_Prefork(t *testing.T) { _ = app.Listen(":443", ListenConfig{TLSMinVersion: tls.VersionTLS11}) //nolint:errcheck // ignore error }) + // Prefork require.Panics(t, func() { _ = app.Listen(":443", ListenConfig{DisableStartupMessage: true, EnablePrefork: true, TLSMinVersion: tls.VersionTLS10}) //nolint:errcheck // ignore error }) require.Panics(t, func() { _ = app.Listen(":443", ListenConfig{DisableStartupMessage: true, EnablePrefork: true, TLSMinVersion: tls.VersionTLS11}) //nolint:errcheck // ignore error }) -} -// go test -run Test_Listen_TLSMinVersion -func Test_Listen_TLSMinVersion(t *testing.T) { - testPreforkMaster = true + // Valid TLSMinVersion + go func() { + time.Sleep(1000 * time.Millisecond) + assert.NoError(t, app.Shutdown()) + }() + require.NoError(t, app.Listen(":0", ListenConfig{TLSMinVersion: tls.VersionTLS13})) - app := New() - require.NoError(t, app.Listen(":99999", ListenConfig{DisableStartupMessage: true, EnablePrefork: true})) + // Valid TLSMinVersion with Prefork + go func() { + time.Sleep(1000 * time.Millisecond) + assert.NoError(t, app.Shutdown()) + }() + require.NoError(t, app.Listen(":99999", ListenConfig{DisableStartupMessage: true, EnablePrefork: true, TLSMinVersion: tls.VersionTLS13})) } // go test -run Test_Listen_TLS