summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com>2022-10-19 15:42:36 +0800
committerGitHub <noreply@github.com>2022-10-19 15:42:36 +0800
commitf7824eee4e23139df1d1667a0946cfee3b6c47aa (patch)
tree643306d863ad34661754650473a7126f54537884 /tests
parentMerge pull request #4308 from gy95/container (diff)
parentRefine tests error message (diff)
downloadkubeedge-f7824eee4e23139df1d1667a0946cfee3b6c47aa.tar.gz
Merge pull request #4306 from Rei1010/errorstring
Refine tests error message
Diffstat (limited to 'tests')
-rw-r--r--tests/e2e/utils/common.go10
-rw-r--r--tests/e2e/utils/rule.go20
2 files changed, 15 insertions, 15 deletions
diff --git a/tests/e2e/utils/common.go b/tests/e2e/utils/common.go
index 4370785b6..7fa1086df 100644
--- a/tests/e2e/utils/common.go
+++ b/tests/e2e/utils/common.go
@@ -743,12 +743,12 @@ func GetDeviceModel(list *v1alpha2.DeviceModelList, getDeviceModelAPI string, ex
if !reflect.DeepEqual(expectedDeviceModel.TypeMeta, deviceModel.TypeMeta) ||
expectedDeviceModel.ObjectMeta.Namespace != deviceModel.ObjectMeta.Namespace ||
!reflect.DeepEqual(expectedDeviceModel.Spec, deviceModel.Spec) {
- return nil, fmt.Errorf("The device model is not matching with what was expected")
+ return nil, fmt.Errorf("the device model is not matching with what was expected")
}
}
}
if !modelExists {
- return nil, fmt.Errorf("The requested device model is not found")
+ return nil, fmt.Errorf("the requested device model is not found")
}
}
return list.Items, nil
@@ -781,7 +781,7 @@ func GetDevice(list *v1alpha2.DeviceList, getDeviceAPI string, expectedDevice *v
expectedDevice.ObjectMeta.Namespace != device.ObjectMeta.Namespace ||
!reflect.DeepEqual(expectedDevice.ObjectMeta.Labels, device.ObjectMeta.Labels) ||
!reflect.DeepEqual(expectedDevice.Spec, device.Spec) {
- return nil, fmt.Errorf("The device is not matching with what was expected")
+ return nil, fmt.Errorf("the device is not matching with what was expected")
}
twinExists := false
for _, expectedTwin := range expectedDevice.Status.Twins {
@@ -800,7 +800,7 @@ func GetDevice(list *v1alpha2.DeviceList, getDeviceAPI string, expectedDevice *v
}
}
if !deviceExists {
- return nil, fmt.Errorf("The requested device is not found")
+ return nil, fmt.Errorf("the requested device is not found")
}
}
return list.Items, nil
@@ -1009,7 +1009,7 @@ func SubscribeMqtt(topic string) (string, error) {
return result, nil
case <-t.C:
close(r)
- return "", fmt.Errorf("Wait for MQTT message time out. ")
+ return "", fmt.Errorf("wait for MQTT message time out. ")
}
}
diff --git a/tests/e2e/utils/rule.go b/tests/e2e/utils/rule.go
index b5442f660..48d961156 100644
--- a/tests/e2e/utils/rule.go
+++ b/tests/e2e/utils/rule.go
@@ -226,19 +226,19 @@ func GetRuleList(list *rulesv1.RuleList, getRuleAPI string, expectedRule *rulesv
if !reflect.DeepEqual(expectedRule.TypeMeta, rule.TypeMeta) ||
expectedRule.ObjectMeta.Namespace != rule.ObjectMeta.Namespace ||
!reflect.DeepEqual(expectedRule.Spec, rule.Spec) {
- return nil, errors.New("The rule is not matching with what was expected")
+ return nil, errors.New("the rule is not matching with what was expected")
}
}
}
if !modelExists {
- return nil, errors.New("The requested rule is not found")
+ return nil, errors.New("the requested rule is not found")
}
}
return list.Items, nil
}
// HandleRule to handle rule.
-func HandleRule(operation, apiserver, UID string, sourceType, targetType rulesv1.RuleEndpointTypeDef) (bool, int) {
+func HandleRule(operation, apiServer, UID string, sourceType, targetType rulesv1.RuleEndpointTypeDef) (bool, int) {
var req *http.Request
var err error
var body io.Reader
@@ -257,10 +257,10 @@ func HandleRule(operation, apiserver, UID string, sourceType, targetType rulesv1
if err != nil {
Fatalf("Marshalling body failed: %v", err)
}
- req, err = http.NewRequest(http.MethodPost, apiserver, bytes.NewBuffer(respBytes))
+ req, err = http.NewRequest(http.MethodPost, apiServer, bytes.NewBuffer(respBytes))
req.Header.Set("Content-Type", "application/json")
case http.MethodDelete:
- req, err = http.NewRequest(http.MethodDelete, apiserver+UID, body)
+ req, err = http.NewRequest(http.MethodDelete, apiServer+UID, body)
req.Header.Set("Content-Type", "application/json")
}
if err != nil {
@@ -282,7 +282,7 @@ func HandleRule(operation, apiserver, UID string, sourceType, targetType rulesv1
}
// HandleRuleEndpoint to handle ruleendpoint.
-func HandleRuleEndpoint(operation string, apiserver string, UID string, endpointType rulesv1.RuleEndpointTypeDef) (bool, int) {
+func HandleRuleEndpoint(operation string, apiServer string, UID string, endpointType rulesv1.RuleEndpointTypeDef) (bool, int) {
var req *http.Request
var err error
var body io.Reader
@@ -301,10 +301,10 @@ func HandleRuleEndpoint(operation string, apiserver string, UID string, endpoint
if err != nil {
Fatalf("Marshalling body failed: %v", err)
}
- req, err = http.NewRequest(http.MethodPost, apiserver, bytes.NewBuffer(respBytes))
+ req, err = http.NewRequest(http.MethodPost, apiServer, bytes.NewBuffer(respBytes))
req.Header.Set("Content-Type", "application/json")
case http.MethodDelete:
- req, err = http.NewRequest(http.MethodDelete, apiserver+UID, body)
+ req, err = http.NewRequest(http.MethodDelete, apiServer+UID, body)
req.Header.Set("Content-Type", "application/json")
}
if err != nil {
@@ -346,12 +346,12 @@ func GetRuleEndpointList(list *rulesv1.RuleEndpointList, getRuleEndpointAPI stri
if !reflect.DeepEqual(expectedRule.TypeMeta, ruleEndpoint.TypeMeta) ||
expectedRule.ObjectMeta.Namespace != ruleEndpoint.ObjectMeta.Namespace ||
!reflect.DeepEqual(expectedRule.Spec, ruleEndpoint.Spec) {
- return nil, errors.New("The ruleendpoint is not matching with what was expected")
+ return nil, errors.New("the ruleendpoint is not matching with what was expected")
}
}
}
if !exists {
- return nil, errors.New("The requested ruleendpoint is not found")
+ return nil, errors.New("the requested ruleendpoint is not found")
}
}
return list.Items, nil