Skip to content

Commit

Permalink
Merge pull request kubeedge#2343 from lvchenggang/fix_grammar_mistakes
Browse files Browse the repository at this point in the history
edge/pkg/edgehub: fix grammar issues
  • Loading branch information
kubeedge-bot authored Nov 23, 2020
2 parents 50655b6 + 6c9f85b commit 47e6e29
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions edge/mocks/edgehub/fake_adapter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion edge/pkg/edgehub/certificate/certmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (cm *CertManager) GetEdgeCert(url string, capem []byte, cert tls.Certificat
return nil, nil, fmt.Errorf("failed to create CSR: %v", err)
}

client, err := http.NewHTTPclientWithCA(capem, cert)
client, err := http.NewHTTPClientWithCA(capem, cert)
if err != nil {
return nil, nil, fmt.Errorf("falied to create http client:%v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion edge/pkg/edgehub/clients/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
//Adapter is a web socket client interface
type Adapter interface {
Init() error
Uninit()
UnInit()
// async mode
Send(message model.Message) error
Receive() (model.Message, error)
Expand Down
4 changes: 2 additions & 2 deletions edge/pkg/edgehub/clients/quicclient/quicclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func (qcc *QuicClient) Init() error {
return nil
}

//Uninit closes the quic connection
func (qcc *QuicClient) Uninit() {
//UnInit closes the quic connection
func (qcc *QuicClient) UnInit() {
qcc.client.Close()
}

Expand Down
4 changes: 2 additions & 2 deletions edge/pkg/edgehub/clients/wsclient/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func (wsc *WebSocketClient) Init() error {
return errors.New("max retry count reached when connecting to cloud")
}

//Uninit closes the websocket connection
func (wsc *WebSocketClient) Uninit() {
//UnInit closes the websocket connection
func (wsc *WebSocketClient) UnInit() {
wsc.connection.Close()
}

Expand Down
10 changes: 5 additions & 5 deletions edge/pkg/edgehub/common/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func NewHTTPClient() *http.Client {
return &http.Client{Transport: transport}
}

// NewHTTPSclient create https client
func NewHTTPSclient(certFile, keyFile string) (*http.Client, error) {
// NewHTTPSClient create https client
func NewHTTPSClient(certFile, keyFile string) (*http.Client, error) {
pool := x509.NewCertPool()
cliCrt, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
klog.Errorf("Cannot create https client , Loadx509keypair err: %v", err)
klog.Errorf("Cannot create https client , Load x509 key pair err: %v", err)
return nil, err
}
tr := &http.Transport{
Expand All @@ -63,8 +63,8 @@ func NewHTTPSclient(certFile, keyFile string) (*http.Client, error) {
return client, nil
}

// NewHTTPclientWithCA create client without certificate
func NewHTTPclientWithCA(capem []byte, certificate tls.Certificate) (*http.Client, error) {
// NewHTTPClientWithCA create client without certificate
func NewHTTPClientWithCA(capem []byte, certificate tls.Certificate) (*http.Client, error) {
pool := x509.NewCertPool()
if ok := pool.AppendCertsFromPEM(capem); !ok {
return nil, fmt.Errorf("cannot parse the certificates")
Expand Down
12 changes: 6 additions & 6 deletions edge/pkg/edgehub/common/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func TestNewHttpClient(t *testing.T) {
}
}

//TestNewHTTPSclient() tests the creation of a new HTTPS client with proper values
func TestNewHTTPSclient(t *testing.T) {
//TestNewHTTPSClient() tests the creation of a new HTTPS client with proper values
func TestNewHTTPSClient(t *testing.T) {
err := util.GenerateTestCertificate("/tmp/kubeedge/testData/", "edge", "edge")
if err != nil {
t.Errorf("Error in generating fake certificates: %v", err)
Expand All @@ -62,7 +62,7 @@ func TestNewHTTPSclient(t *testing.T) {
wantErr bool
}{
{
name: "TestNewHTTPSclient: ",
name: "TestNewHTTPSClient: ",
args: args{
keyFile: KeyFile,
certFile: CertFile,
Expand Down Expand Up @@ -94,13 +94,13 @@ func TestNewHTTPSclient(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := NewHTTPSclient(tt.args.certFile, tt.args.keyFile)
got, err := NewHTTPSClient(tt.args.certFile, tt.args.keyFile)
if (err != nil) != tt.wantErr {
t.Errorf("NewHTTPSclient() error = %v, expectedError = %v", err, tt.wantErr)
t.Errorf("NewHTTPSClient() error = %v, expectedError = %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewHTTPSclient() = %v, want %v", got, tt.want)
t.Errorf("NewHTTPSClient() = %v, want %v", got, tt.want)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion edge/pkg/edgehub/edgehub.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (eh *EdgeHub) Start() {
// wait the stop signal
// stop authinfo manager/websocket connection
<-eh.reconnectChan
eh.chClient.Uninit()
eh.chClient.UnInit()

// execute hook fun after disconnect
eh.pubConnectInfo(false)
Expand Down

0 comments on commit 47e6e29

Please sign in to comment.