Fix tests

This commit is contained in:
世界
2024-11-18 18:59:19 +08:00
parent 7693e985af
commit df8a3e912e
29 changed files with 453 additions and 391 deletions

View File

@@ -10,9 +10,9 @@ import (
)
func TestOptionsWrapper(t *testing.T) {
inbound := option.LegacyInbound{
inbound := option.Inbound{
Type: C.TypeHTTP,
HTTPOptions: option.HTTPMixedInboundOptions{
Options: &option.HTTPMixedInboundOptions{
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
TLS: &option.InboundTLSOptions{
Enabled: true,
@@ -20,13 +20,11 @@ func TestOptionsWrapper(t *testing.T) {
},
},
}
rawOptions, err := inbound.RawOptions()
require.NoError(t, err)
tlsOptionsWrapper, loaded := rawOptions.(option.InboundTLSOptionsWrapper)
tlsOptionsWrapper, loaded := inbound.Options.(option.InboundTLSOptionsWrapper)
require.True(t, loaded, "find inbound tls options")
tlsOptions := tlsOptionsWrapper.TakeInboundTLSOptions()
require.NotNil(t, tlsOptions, "find inbound tls options")
tlsOptions.Enabled = false
tlsOptionsWrapper.ReplaceInboundTLSOptions(tlsOptions)
require.False(t, inbound.HTTPOptions.TLS.Enabled, "replace tls enabled")
require.False(t, inbound.Options.(*option.HTTPMixedInboundOptions).TLS.Enabled, "replace tls enabled")
}