From 7ed69492c725962b6be1bad7d54cb3bc0abeb859 Mon Sep 17 00:00:00 2001 From: Francois Poinsot Date: Mon, 3 Jun 2019 10:57:45 +0200 Subject: [PATCH] minors fixes: (#35) - comment that new accepted parameter are path to files - generate mocks - remove unused stanza in config.toml --- Gopkg.toml | 10 -------- cli/cmd/root.go | 30 ++++++++++++------------ lib/connectors/mock_base_client.go | 17 ++++++++++---- lib/connectors/mock_high_level_client.go | 17 ++++++++++++++ 4 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index 500b1a6..c58ac0b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -20,24 +20,14 @@ # name = "github.com/x/y" # version = "2.4.0" - -[[constraint]] - branch = "master" - name = "github.com/mitchellh/go-homedir" - [[constraint]] name = "github.com/spf13/cobra" version = "0.0.1" -[[constraint]] - name = "github.com/spf13/viper" - version = "1.0.0" - [[constraint]] name = "github.com/stretchr/testify" version = "1.1.4" - [[constraint]] name = "gopkg.in/resty.v1" version = "1.11.0" diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 8e3f097..27af691 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -22,19 +22,19 @@ import ( ) var ( - url string - connector string - filePath string - configString string - sync bool - status bool - config bool - tasks bool - verbose bool - SSLInsecure bool - parallel int - SSLClientCertificate string - SSLClientPrivateKey string + url string + connector string + filePath string + configString string + sync bool + status bool + config bool + tasks bool + verbose bool + SSLInsecure bool + parallel int + SSLClientCertificate string + SSLClientPrivateKey string ) var RootCmd = &cobra.Command{ @@ -58,6 +58,6 @@ func init() { RootCmd.PersistentFlags().StringVarP(&url, "url", "u", "http://localhost:8083", "kafka connect URL") RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, `/!\ very verbose`) RootCmd.PersistentFlags().BoolVarP(&SSLInsecure, "insecure-skip-verify", "i", false, `skip SSL/TLS verification`) - RootCmd.PersistentFlags().StringVarP(&SSLClientCertificate, "ssl-client-certificate", "C", "", `client certificate, must contain PEM encoded data`) - RootCmd.PersistentFlags().StringVarP(&SSLClientPrivateKey, "ssl-client-key", "K", "", `client private key`) + RootCmd.PersistentFlags().StringVarP(&SSLClientCertificate, "ssl-client-certificate", "C", "", `path to client certificate, must contain PEM encoded data`) + RootCmd.PersistentFlags().StringVarP(&SSLClientPrivateKey, "ssl-client-key", "K", "", `path to client private key`) } diff --git a/lib/connectors/mock_base_client.go b/lib/connectors/mock_base_client.go index 1568842..7d1b403 100644 --- a/lib/connectors/mock_base_client.go +++ b/lib/connectors/mock_base_client.go @@ -5,6 +5,7 @@ package connectors import mock "github.com/stretchr/testify/mock" +import tls "crypto/tls" // MockBaseClient is an autogenerated mock type for the BaseClient type type MockBaseClient struct { @@ -263,6 +264,17 @@ func (_m *MockBaseClient) ResumeConnector(req ConnectorRequest) (EmptyResponse, return r0, r1 } +// SetClientCertificates provides a mock function with given fields: certs +func (_m *MockBaseClient) SetClientCertificates(certs ...tls.Certificate) { + _va := make([]interface{}, len(certs)) + for _i := range certs { + _va[_i] = certs[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + _m.Called(_ca...) +} + // SetDebug provides a mock function with given fields: func (_m *MockBaseClient) SetDebug() { _m.Called() @@ -273,11 +285,6 @@ func (_m *MockBaseClient) SetInsecureSSL() { _m.Called() } -// SetClientCertificates provides a mock function with given fields: -func (_m *MockBaseClient) SetClientCertificates(certFile string, keyFile string) { - _m.Called() -} - // UpdateConnector provides a mock function with given fields: req func (_m *MockBaseClient) UpdateConnector(req CreateConnectorRequest) (ConnectorResponse, error) { ret := _m.Called(req) diff --git a/lib/connectors/mock_high_level_client.go b/lib/connectors/mock_high_level_client.go index 412d5ad..31a6631 100644 --- a/lib/connectors/mock_high_level_client.go +++ b/lib/connectors/mock_high_level_client.go @@ -5,6 +5,7 @@ package connectors import mock "github.com/stretchr/testify/mock" +import tls "crypto/tls" // MockHighLevelClient is an autogenerated mock type for the HighLevelClient type type MockHighLevelClient struct { @@ -312,6 +313,17 @@ func (_m *MockHighLevelClient) ResumeConnector(req ConnectorRequest, sync bool) return r0, r1 } +// SetClientCertificates provides a mock function with given fields: certs +func (_m *MockHighLevelClient) SetClientCertificates(certs ...tls.Certificate) { + _va := make([]interface{}, len(certs)) + for _i := range certs { + _va[_i] = certs[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + _m.Called(_ca...) +} + // SetDebug provides a mock function with given fields: func (_m *MockHighLevelClient) SetDebug() { _m.Called() @@ -322,6 +334,11 @@ func (_m *MockHighLevelClient) SetInsecureSSL() { _m.Called() } +// SetParallelism provides a mock function with given fields: value +func (_m *MockHighLevelClient) SetParallelism(value int) { + _m.Called(value) +} + // UpdateConnector provides a mock function with given fields: req, sync func (_m *MockHighLevelClient) UpdateConnector(req CreateConnectorRequest, sync bool) (ConnectorResponse, error) { ret := _m.Called(req, sync)