diff options
| author | Shelley-BaoYue <baoyue2@huawei.com> | 2023-08-18 15:14:34 +0800 |
|---|---|---|
| committer | Shelley-BaoYue <baoyue2@huawei.com> | 2023-08-21 21:13:46 +0800 |
| commit | 833346c40013fca6224534c573fd84c7e38bda4b (patch) | |
| tree | ef9847cf9c0faa9deb36e7d986db6867ecc9b1a5 /edge/test | |
| parent | update go version to 1.19 (diff) | |
| download | kubeedge-833346c40013fca6224534c573fd84c7e38bda4b.tar.gz | |
fix lint
Signed-off-by: Shelley-BaoYue <baoyue2@huawei.com>
Diffstat (limited to 'edge/test')
| -rw-r--r-- | edge/test/integration/appdeployment/application_suite_test.go | 4 | ||||
| -rw-r--r-- | edge/test/integration/appdeployment/application_test.go | 2 | ||||
| -rw-r--r-- | edge/test/integration/device/device_suite_test.go | 6 | ||||
| -rwxr-xr-x | edge/test/integration/device/device_test.go | 4 | ||||
| -rwxr-xr-x | edge/test/integration/utils/common/log.go | 10 | ||||
| -rwxr-xr-x | edge/test/integration/utils/edge/config.go | 12 | ||||
| -rwxr-xr-x | edge/test/integration/utils/edge/testcontext.go | 4 | ||||
| -rw-r--r-- | edge/test/integration/utils/helpers/helpers.go | 26 | ||||
| -rw-r--r-- | edge/test/test.go | 6 |
9 files changed, 37 insertions, 37 deletions
diff --git a/edge/test/integration/appdeployment/application_suite_test.go b/edge/test/integration/appdeployment/application_suite_test.go index dadd24a3c..b991bd5f6 100644 --- a/edge/test/integration/appdeployment/application_suite_test.go +++ b/edge/test/integration/appdeployment/application_suite_test.go @@ -27,13 +27,13 @@ import ( "github.com/kubeedge/kubeedge/edge/test/integration/utils/edge" ) -//context to load config and access across the package +// context to load config and access across the package var ( ctx *edge.TestContext cfg edge.Config ) -//Function to run the Ginkgo Test +// Function to run the Ginkgo Test func TestEdgecoreAppDeployment(t *testing.T) { RegisterFailHandler(Fail) //var UID string diff --git a/edge/test/integration/appdeployment/application_test.go b/edge/test/integration/appdeployment/application_test.go index e0a2001fa..4385609ee 100644 --- a/edge/test/integration/appdeployment/application_test.go +++ b/edge/test/integration/appdeployment/application_test.go @@ -35,7 +35,7 @@ const ( AppHandler = "/pods" ) -//Run Test cases +// Run Test cases var _ = Describe("Application deployment in edgecore Testing", func() { var UID string Context("Test application deployment and delete deployment", func() { diff --git a/edge/test/integration/device/device_suite_test.go b/edge/test/integration/device/device_suite_test.go index 3e421cc44..56d2519f6 100644 --- a/edge/test/integration/device/device_suite_test.go +++ b/edge/test/integration/device/device_suite_test.go @@ -31,13 +31,13 @@ import ( "github.com/kubeedge/kubeedge/edge/test/integration/utils/helpers" ) -//context to load config and access across the package +// context to load config and access across the package var ( ctx *edge.TestContext cfg edge.Config ) -//Interface to validate the MQTT connection. +// Interface to validate the MQTT connection. type Token interface { Wait() bool WaitTimeout(time.Duration) bool @@ -63,7 +63,7 @@ var ( ClientID = "eventbus" ) -//Function to run the Ginkgo Test +// Function to run the Ginkgo Test func TestEdgecoreEventBus(t *testing.T) { RegisterFailHandler(Fail) var _ = BeforeSuite(func() { diff --git a/edge/test/integration/device/device_test.go b/edge/test/integration/device/device_test.go index 23b1bff56..0a0ebefc1 100755 --- a/edge/test/integration/device/device_test.go +++ b/edge/test/integration/device/device_test.go @@ -32,7 +32,7 @@ import ( . "github.com/kubeedge/kubeedge/edge/test/integration/utils/helpers" ) -//Devicestate from subscribed MQTT topic +// Devicestate from subscribed MQTT topic var DeviceState string type DeviceUpdates struct { @@ -97,7 +97,7 @@ var DeviceATT dttype.Device var DeviceIDWithTwin string var DeviceTW dttype.Device -//Run Test cases +// Run Test cases var _ = Describe("Event Bus Testing", func() { Context("Publish on eventbus topics throgh MQTT internal broker", func() { BeforeEach(func() { diff --git a/edge/test/integration/utils/common/log.go b/edge/test/integration/utils/common/log.go index 18be56712..1bc3a71ea 100755 --- a/edge/test/integration/utils/common/log.go +++ b/edge/test/integration/utils/common/log.go @@ -23,30 +23,30 @@ 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("FAIL", msg) ginkgo.Fail(nowStamp()+": "+msg, 1) } -//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 to print the test case name and status of execution func PrintTestcaseNameandStatus() { var Status string testSpecReport := ginkgo.CurrentGinkgoTestDescription() diff --git a/edge/test/integration/utils/edge/config.go b/edge/test/integration/utils/edge/config.go index ad433fa1c..455223898 100755 --- a/edge/test/integration/utils/edge/config.go +++ b/edge/test/integration/utils/edge/config.go @@ -26,7 +26,7 @@ import ( "github.com/kubeedge/kubeedge/edge/test/integration/utils/common" ) -//config.json decode struct +// config.json decode struct type Config struct { MqttEndpoint string `json:"mqttEndpoint"` TestManager string `json:"testManager"` @@ -35,10 +35,10 @@ type Config struct { NodeID string `json:"nodeId"` } -//config struct +// config struct var config *Config -//get config.json path +// get config.json path func LoadConfig() Config { if config == nil { config = loadConfigJSONFromPath() @@ -46,7 +46,7 @@ func LoadConfig() Config { return *config } -//Load Config.json from the PWD, and decode the config. +// Load Config.json from the PWD, and decode the config. func loadConfigJSONFromPath() *Config { path := getConfigPath() _, err := filepath.Abs(filepath.Dir(path)) @@ -69,7 +69,7 @@ func loadConfigJSONFromPath() *Config { return config } -//Get config path from Env or hard code the file path +// Get config path from Env or hard code the file path func getConfigPath() string { path := os.Getenv("TESTCONFIG") if path == "" { @@ -78,7 +78,7 @@ func getConfigPath() string { return path } -//function to Generate Random string +// function to Generate Random string func GetRandomString(length int) string { str := "-0123456789abcdefghijklmnopqrstuvwxyz" bytes := []byte(str) diff --git a/edge/test/integration/utils/edge/testcontext.go b/edge/test/integration/utils/edge/testcontext.go index 9b4f92260..2c62b3c07 100755 --- a/edge/test/integration/utils/edge/testcontext.go +++ b/edge/test/integration/utils/edge/testcontext.go @@ -16,12 +16,12 @@ limitations under the License. package edge -//Test context struct +// Test context struct type TestContext struct { Cfg Config } -//function to get the testcontext Object. +// function to get the testcontext Object. func NewTestContext(cfg Config) *TestContext { return &TestContext{ Cfg: cfg, diff --git a/edge/test/integration/utils/helpers/helpers.go b/edge/test/integration/utils/helpers/helpers.go index 1edf6b4ea..059963025 100644 --- a/edge/test/integration/utils/helpers/helpers.go +++ b/edge/test/integration/utils/helpers/helpers.go @@ -37,13 +37,13 @@ import ( "github.com/kubeedge/kubeedge/edge/test/integration/utils/edge" ) -//DeviceUpdate device update +// DeviceUpdate device update type DeviceUpdate struct { State string `json:"state,omitempty"` Attributes map[string]*dttype.MsgAttr `json:"attributes"` } -//Device the struct of device +// Device the struct of device type Device struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` @@ -52,7 +52,7 @@ type Device struct { LastOnline string `json:"last_online,omitempty"` } -//Attribute Structure to read data from DB (Should match with the DB-table 'device_attr' schema) +// Attribute Structure to read data from DB (Should match with the DB-table 'device_attr' schema) type Attribute struct { ID string `json:"id,omitempty"` DeviceID string `json:"deviceid,omitempty"` @@ -64,7 +64,7 @@ type Attribute struct { MetaData string `json:"metadata,omitempty"` } -//Twin Structure to read data from DB (Should match with the DB-table 'device_twin' schema) +// Twin Structure to read data from DB (Should match with the DB-table 'device_twin' schema) type TwinAttribute struct { ID string `json:"id,omitempty"` DeviceID string `json:"deviceid,omitempty"` @@ -85,7 +85,7 @@ func GenerateDeviceID(deviceSuffix string) string { return deviceSuffix + edge.GetRandomString(10) } -//Function to Generate Device +// Function to Generate Device func CreateDevice(deviceID string, deviceName string, deviceState string) dttype.Device { device := dttype.Device{ ID: deviceID, @@ -98,7 +98,7 @@ func CreateDevice(deviceID string, deviceName string, deviceState string) dttype return device } -//Function to add Device attribute to existing device +// Function to add Device attribute to existing device func AddDeviceAttribute(device dttype.Device, attributeName string, attributeValue string, attributeType string) { var optional = true var typeMeta = dttype.TypeMetadata{Type: attributeType} @@ -106,7 +106,7 @@ func AddDeviceAttribute(device dttype.Device, attributeName string, attributeVal device.Attributes[attributeName] = &attribute } -//Function to add Twin attribute to existing device +// Function to add Twin attribute to existing device func AddTwinAttribute(device dttype.Device, attributeName string, attributeValue string, attributeType string) { value := attributeValue optional := true @@ -125,7 +125,7 @@ func AddTwinAttribute(device dttype.Device, attributeName string, attributeValue device.Twin[attributeName] = &msgTwin } -//Function to access the edgecore DB and return the device state. +// Function to access the edgecore DB and return the device state. func GetDeviceStateFromDB(deviceID string) string { var device Device db, err := sql.Open("sqlite3", utils.DBFile) @@ -222,7 +222,7 @@ func HubClientInit(server, clientID, username, password string) *MQTT.ClientOpti return opts } -//function to handle device addition and deletion. +// function to handle device addition and deletion. func HandleAddAndDeleteDevice(operation, testMgrEndPoint string, device dttype.Device) bool { var httpMethod string var payload dttype.MembershipUpdate @@ -270,7 +270,7 @@ func HandleAddAndDeleteDevice(operation, testMgrEndPoint string, device dttype.D return true } -//HandleAddAndDeletePods is function to handle app deployment/delete deployment. +// HandleAddAndDeletePods is function to handle app deployment/delete deployment. func HandleAddAndDeletePods(operation string, edgedpoint string, UID string, container []v1.Container, restartPolicy v1.RestartPolicy) bool { var httpMethod string switch operation { @@ -314,7 +314,7 @@ func HandleAddAndDeletePods(operation string, edgedpoint string, UID string, con return true } -//Function to get the pods from Edged +// Function to get the pods from Edged func GetPods(EdgedEndpoint string) (v1.PodList, error) { var pods v1.PodList var bytes io.Reader @@ -346,7 +346,7 @@ func GetPods(EdgedEndpoint string) (v1.PodList, error) { return pods, nil } -//CheckPodRunningState is function to check the Pod state +// CheckPodRunningState is function to check the Pod state func CheckPodRunningState(EdgedEndPoint, podname string) { gomega.Eventually(func() string { var status string @@ -362,7 +362,7 @@ func CheckPodRunningState(EdgedEndPoint, podname string) { }, "240s", "2s").Should(gomega.Equal("Running"), "Application Deployment is Unsuccessful, Pod has not come to Running State") } -//CheckPodDeletion is function to check pod deletion +// CheckPodDeletion is function to check pod deletion func CheckPodDeletion(EdgedEndPoint, UID string) { gomega.Eventually(func() bool { var IsExist = false diff --git a/edge/test/test.go b/edge/test/test.go index 446488d98..047403b79 100644 --- a/edge/test/test.go +++ b/edge/test/test.go @@ -47,7 +47,7 @@ func (tm *testManager) Enable() bool { return tm.enable } -//Function to get the pods from Edged +// Function to get the pods from Edged func GetPodListFromEdged(w http.ResponseWriter) error { var pods v1.PodList var bytes io.Reader @@ -87,7 +87,7 @@ func GetPodListFromEdged(w http.ResponseWriter) error { return nil } -//Function to handle Get/Add/Delete deployment list. +// Function to handle Get/Add/Delete deployment list. func (tm *testManager) podHandler(w http.ResponseWriter, req *http.Request) { var operation string var p v1.Pod @@ -127,7 +127,7 @@ func (tm *testManager) podHandler(w http.ResponseWriter, req *http.Request) { } } -//Function to handle device addition and removal from the edgenode +// Function to handle device addition and removal from the edgenode func (tm *testManager) deviceHandler(w http.ResponseWriter, req *http.Request) { var operation string var Content interface{} |
