diff --git a/tools/sql/clitest/handlerTest.go b/tools/sql/clitest/handler_test.go similarity index 79% rename from tools/sql/clitest/handlerTest.go rename to tools/sql/clitest/handler_test.go index 484d2344a93..4236f9dfca5 100644 --- a/tools/sql/clitest/handlerTest.go +++ b/tools/sql/clitest/handler_test.go @@ -31,7 +31,6 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "go.temporal.io/server/common/auth" "go.temporal.io/server/common/service/config" "go.temporal.io/server/environment" "go.temporal.io/server/tools/common/schema" @@ -85,28 +84,4 @@ func (s *HandlerTestSuite) TestValidateConnectConfig() { cfg.DatabaseName = "foobar" s.Nil(sql.ValidateConnectConfig(cfg, false)) s.Nil(sql.ValidateConnectConfig(cfg, true)) - - cfg.TLS = &auth.TLS{} - cfg.TLS.Enabled = true - s.NotNil(sql.ValidateConnectConfig(cfg, false)) - s.NotNil(sql.ValidateConnectConfig(cfg, true)) - - cfg.TLS.CaFile = "ca.pem" - s.Nil(sql.ValidateConnectConfig(cfg, false)) - s.Nil(sql.ValidateConnectConfig(cfg, true)) - - cfg.TLS.KeyFile = "key_file" - cfg.TLS.CertFile = "" - s.NotNil(sql.ValidateConnectConfig(cfg, false)) - s.NotNil(sql.ValidateConnectConfig(cfg, true)) - - cfg.TLS.KeyFile = "" - cfg.TLS.CertFile = "cert_file" - s.NotNil(sql.ValidateConnectConfig(cfg, false)) - s.NotNil(sql.ValidateConnectConfig(cfg, true)) - - cfg.TLS.KeyFile = "key_file" - cfg.TLS.CertFile = "cert_file" - s.Nil(sql.ValidateConnectConfig(cfg, false)) - s.Nil(sql.ValidateConnectConfig(cfg, true)) } diff --git a/tools/sql/handler.go b/tools/sql/handler.go index 0cb204d9419..138bee3cffc 100644 --- a/tools/sql/handler.go +++ b/tools/sql/handler.go @@ -265,19 +265,7 @@ func ValidateConnectConfig(cfg *config.SQL, isDryRun bool) error { } cfg.DatabaseName = schema.DryrunDBName } - if cfg.TLS != nil && cfg.TLS.Enabled { - enabledCaFile := cfg.TLS.CaFile != "" - enabledCertFile := cfg.TLS.CertFile != "" - enabledKeyFile := cfg.TLS.KeyFile != "" - if (enabledCertFile && !enabledKeyFile) || (!enabledCertFile && enabledKeyFile) { - return schema.NewConfigError("must have both CertFile and KeyFile set") - } - - if !enabledCaFile && !enabledCertFile && !enabledKeyFile { - return schema.NewConfigError("must provide tls certs to use") - } - } return nil }