summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorShelley-BaoYue <baoyue2@huawei.com>2023-08-18 15:14:34 +0800
committerShelley-BaoYue <baoyue2@huawei.com>2023-08-21 21:13:46 +0800
commit833346c40013fca6224534c573fd84c7e38bda4b (patch)
treeef9847cf9c0faa9deb36e7d986db6867ecc9b1a5 /tests
parentupdate go version to 1.19 (diff)
downloadkubeedge-833346c40013fca6224534c573fd84c7e38bda4b.tar.gz
fix lint
Signed-off-by: Shelley-BaoYue <baoyue2@huawei.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/e2e/utils/config.go3
-rw-r--r--tests/e2e/utils/context.go7
-rw-r--r--tests/e2e/utils/log.go13
-rw-r--r--tests/e2e/utils/node.go14
-rw-r--r--tests/e2e_edgesite/edgesite_test.go2
-rw-r--r--tests/e2e_keadm/keadm_test.go2
6 files changed, 22 insertions, 19 deletions
diff --git a/tests/e2e/utils/config.go b/tests/e2e/utils/config.go
index 0ba26a532..ada13d495 100644
--- a/tests/e2e/utils/config.go
+++ b/tests/e2e/utils/config.go
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
+
package utils
import (
@@ -23,7 +24,7 @@ import (
cliflag "k8s.io/component-base/cli/flag"
)
-//config.json decode struct
+// Config decode struct
type Config struct {
AppImageURL []string `json:"image_url"`
K8SMasterForKubeEdge string `json:"k8smasterforkubeedge"`
diff --git a/tests/e2e/utils/context.go b/tests/e2e/utils/context.go
index 121becca7..c3754ef73 100644
--- a/tests/e2e/utils/context.go
+++ b/tests/e2e/utils/context.go
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
+
package utils
import (
@@ -22,19 +23,19 @@ import (
"time"
)
-//Test context struct
+// TestContext struct
type TestContext struct {
Cfg Config
}
-//NewTestContext function to build testcontext with provided config.
+// NewTestContext function to build testcontext with provided config.
func NewTestContext(cfg Config) *TestContext {
return &TestContext{
Cfg: cfg,
}
}
-//SendHTTPRequest Function to prepare the http req and send
+// SendHTTPRequest Function to prepare the http req and send
func SendHTTPRequest(method, reqAPI string) (*http.Response, error) {
var body io.Reader
var resp *http.Response
diff --git a/tests/e2e/utils/log.go b/tests/e2e/utils/log.go
index 55b4dde98..f1cffdaf0 100644
--- a/tests/e2e/utils/log.go
+++ b/tests/e2e/utils/log.go
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
+
package utils
import (
@@ -22,36 +23,36 @@ import (
"github.com/onsi/ginkgo"
)
-//Function to get time in millisec
+// nowStamp get time in millisec
func nowStamp() string {
return time.Now().Format(time.StampMilli)
}
-//functiont to log the Ginkgo framework logs
+// logf log the Ginkgo framework logs
func logf(level string, format string, args ...interface{}) {
fmt.Fprintf(ginkgo.GinkgoWriter, nowStamp()+": "+level+": "+format+"\n", args...)
}
-//Funciton to log Filure logs
+// Fatalf log Failure logs
func Fatalf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
logf("Fatal", msg)
ginkgo.Fail(nowStamp()+": "+msg, 1)
}
-//function for Error log
+// Errorf for Error log
func Errorf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
logf("Error", msg)
}
-//function for log level
+// Infof for log level
func Infof(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
logf("Info", msg)
}
-//Function to print the test case name and status of execution
+// PrintTestcaseNameandStatus print the test case name and status of execution
func PrintTestcaseNameandStatus() {
var Status string
testSpecReport := ginkgo.CurrentGinkgoTestDescription()
diff --git a/tests/e2e/utils/node.go b/tests/e2e/utils/node.go
index 27640eb24..033b356af 100644
--- a/tests/e2e/utils/node.go
+++ b/tests/e2e/utils/node.go
@@ -50,7 +50,7 @@ func getpwd() string {
return dir
}
-//DeRegisterNodeFromMaster function to deregister the node from master
+// DeRegisterNodeFromMaster function to deregister the node from master
func DeRegisterNodeFromMaster(nodehandler, nodename string) error {
resp, err := SendHTTPRequest(http.MethodDelete, nodehandler+"/"+nodename)
if err != nil {
@@ -63,7 +63,7 @@ func DeRegisterNodeFromMaster(nodehandler, nodename string) error {
return nil
}
-//GenerateNodeReqBody function to generate the node request body
+// GenerateNodeReqBody function to generate the node request body
func GenerateNodeReqBody(nodeid, nodeselector string) (map[string]interface{}, error) {
var temp map[string]interface{}
@@ -77,7 +77,7 @@ func GenerateNodeReqBody(nodeid, nodeselector string) (map[string]interface{}, e
return temp, nil
}
-//RegisterNodeToMaster function to register node to master
+// RegisterNodeToMaster function to register node to master
func RegisterNodeToMaster(UID, nodehandler, nodeselector string) error {
body, err := GenerateNodeReqBody(UID, nodeselector)
if err != nil {
@@ -117,7 +117,7 @@ func RegisterNodeToMaster(UID, nodehandler, nodeselector string) error {
return nil
}
-//CheckNodeReadyStatus function to get node status
+// CheckNodeReadyStatus function to get node status
func CheckNodeReadyStatus(nodehandler, nodename string) string {
var node v1.Node
var nodeStatus = "unknown"
@@ -142,7 +142,7 @@ func CheckNodeReadyStatus(nodehandler, nodename string) string {
return string(node.Status.Phase)
}
-//CheckNodeDeleteStatus function to check node delete status
+// CheckNodeDeleteStatus function to check node delete status
func CheckNodeDeleteStatus(nodehandler, nodename string) int {
resp, err := SendHTTPRequest(http.MethodGet, nodehandler+"/"+nodename)
if err != nil {
@@ -153,7 +153,7 @@ func CheckNodeDeleteStatus(nodehandler, nodename string) int {
return resp.StatusCode
}
-//HandleConfigmap function to create configmaps for respective edgenodes
+// HandleConfigmap function to create configmaps for respective edgenodes
func HandleConfigmap(configName chan error, operation, confighandler string, IsEdgeCore bool) {
var req *http.Request
var file string
@@ -251,7 +251,7 @@ func TaintEdgeDeployedNode(toTaint bool, taintHandler string) error {
return nil
}
-//GetNodes function to get configmaps for respective edgenodes
+// GetNodes function to get configmaps for respective edgenodes
func GetNodes(api string) v1.NodeList {
var nodes v1.NodeList
resp, err := SendHTTPRequest(http.MethodGet, api)
diff --git a/tests/e2e_edgesite/edgesite_test.go b/tests/e2e_edgesite/edgesite_test.go
index 86c5eb0a5..b5c529d68 100644
--- a/tests/e2e_edgesite/edgesite_test.go
+++ b/tests/e2e_edgesite/edgesite_test.go
@@ -35,7 +35,7 @@ import (
var DeploymentTestTimerGroup = utils.NewTestTimerGroup()
-//Run Test cases
+// Run Test cases
var _ = Describe("Application deployment test in E2E scenario using EdgeSite", func() {
var UID string
var testTimer *utils.TestTimer
diff --git a/tests/e2e_keadm/keadm_test.go b/tests/e2e_keadm/keadm_test.go
index cf57579b3..030a5ca87 100644
--- a/tests/e2e_keadm/keadm_test.go
+++ b/tests/e2e_keadm/keadm_test.go
@@ -31,7 +31,7 @@ import (
var DeploymentTestTimerGroup = utils.NewTestTimerGroup()
-//Run Test cases
+// Run Test cases
var _ = Describe("Application deployment test in keadm E2E scenario", func() {
var testTimer *utils.TestTimer
var testSpecReport GinkgoTestDescription