You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/08 01:34:06 UTC

[GitHub] [apisix-dashboard] tokers commented on a change in pull request #1436: feat: refactor ssl unit test

tokers commented on a change in pull request #1436:
URL: https://github.com/apache/apisix-dashboard/pull/1436#discussion_r571736462



##########
File path: api/internal/handler/ssl/ssl_test.go
##########
@@ -19,146 +19,859 @@ package ssl
 
 import (
 	"encoding/json"
+	"errors"
+	"fmt"
+	"io/ioutil"
+	"net/http"
 	"testing"
-	"time"
 
 	"github.com/shiningrush/droplet"
+	"github.com/shiningrush/droplet/data"
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/mock"
 
-	"github.com/apisix/manager-api/internal/conf"
 	"github.com/apisix/manager-api/internal/core/entity"
-	"github.com/apisix/manager-api/internal/core/storage"
 	"github.com/apisix/manager-api/internal/core/store"
+	"github.com/apisix/manager-api/internal/handler"
+	"github.com/apisix/manager-api/internal/utils/consts"
 )
 
-func TestSSL(t *testing.T) {
-	// init
-	err := storage.InitETCDClient(conf.ETCDConfig)
+func getTestKeyCert(t *testing.T) (string, string) {
+	testCert, err := ioutil.ReadFile("../../../test/certs/test2.crt")
 	assert.Nil(t, err)
-	err = store.InitStores()
+	testKey, err := ioutil.ReadFile("../../../test/certs/test2.key")

Review comment:
       If the key pair is not used in other pleases, what about just put them in the `testdata` directory.

##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -494,3 +504,4 @@ func (h *Handler) Exist(c droplet.Context) (interface{}, error) {
 
 	return nil, nil
 }
+

Review comment:
       Redundant empty line.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org