Bladeren bron

Fix Edgex pub client tool issue (#145)

* add latency for sending data

* add latency for sending data

* Update actions

* debug scripts

* debug scripts

* debug scripts

* debug scripts

* debug scripts

* debug scripts

* debug scripts

* debug scripts

* debug scriptsush

* debug scriptsush

* fix script issue

* add select_edgex_condition_rule.jmx script back

Co-authored-by: zhanghongtong <zhanghongtong@foxmail.com>
jinfahua 5 jaren geleden
bovenliggende
commit
5622cc8f32
3 gewijzigde bestanden met toevoegingen van 36 en 21 verwijderingen
  1. 2 0
      .github/workflows/fvt_tests.yaml
  2. 20 18
      fvt_scripts/edgex/pub.go
  3. 14 3
      fvt_scripts/select_edgex_another_bus_rule.jmx

+ 2 - 0
.github/workflows/fvt_tests.yaml

@@ -39,6 +39,8 @@ jobs:
             wget -O emqx.deb https://www.emqx.io/downloads/broker/v4.0.2/emqx-ubuntu18.04-${EMQX_VERSION}_amd64.deb
             sudo dpkg -i emqx.deb
         - uses: actions/checkout@v2
+        - name: cat edgex_source.go
+          run: cat xstream/extensions/edgex_source.go
         - name: cat user.properties
           run:  cat /tmp/apache-jmeter-5.2.1/user.properties
         - name: cat edgex.yaml

+ 20 - 18
fvt_scripts/edgex/pub.go

@@ -12,25 +12,19 @@ import (
 	"os"
 	"time"
 )
-var msgConfig1 = types.MessageBusConfig{
-	PublishHost: types.HostInfo{
-		Host:     "*",
-		Port:     5570,
-		Protocol: "tcp",
-	},
-	Type:messaging.ZeroMQ,
-}
 
-var msgConfig2 = types.MessageBusConfig{
-	PublishHost: types.HostInfo{
-		Host:     "*",
-		Port:     5571,
-		Protocol: "tcp",
-	},
-	Type:messaging.ZeroMQ,
-}
+
 
 func pubEventClientZeroMq() {
+	var msgConfig1 = types.MessageBusConfig{
+		PublishHost: types.HostInfo{
+			Host:     "*",
+			Port:     5570,
+			Protocol: "tcp",
+		},
+		Type:messaging.ZeroMQ,
+	}
+
 	if msgClient, err := messaging.NewMessageClient(msgConfig1); err != nil {
 		log.Fatal(err)
 	} else {
@@ -81,7 +75,14 @@ func pubEventClientZeroMq() {
 }
 
 func pubToAnother() {
-	msgConfig1.Type = messaging.ZeroMQ
+	var msgConfig2 = types.MessageBusConfig{
+		PublishHost: types.HostInfo{
+			Host:     "*",
+			Port:     5571,
+			Protocol: "tcp",
+		},
+		Type:messaging.ZeroMQ,
+	}
 	if msgClient, err := messaging.NewMessageClient(msgConfig2); err != nil {
 		log.Fatal(err)
 	} else {
@@ -108,8 +109,9 @@ func pubToAnother() {
 		if e := msgClient.Publish(env, "application"); e != nil {
 			log.Fatal(e)
 		} else {
-			fmt.Printf("Pub successful: %s\n", data)
+			fmt.Printf("pubToAnother successful: %s\n", data)
 		}
+		time.Sleep(1 * time.Second)
 	}
 }
 

+ 14 - 3
fvt_scripts/select_edgex_another_bus_rule.jmx

@@ -237,7 +237,7 @@
           <hashTree>
             <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true">
               <collectionProp name="Asserion.test_strings">
-                <stringProp name="-99726403">Pub successful</stringProp>
+                <stringProp name="-1026534321">pubToAnother successful</stringProp>
               </collectionProp>
               <stringProp name="Assertion.custom_message"></stringProp>
               <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
@@ -245,6 +245,17 @@
               <intProp name="Assertion.test_type">16</intProp>
             </ResponseAssertion>
             <hashTree/>
+            <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
+              <stringProp name="ConstantTimer.delay">1000</stringProp>
+            </ConstantTimer>
+            <hashTree/>
+            <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="BeanShell PostProcessor" enabled="true">
+              <boolProp name="resetInterpreter">false</boolProp>
+              <stringProp name="parameters"></stringProp>
+              <stringProp name="filename"></stringProp>
+              <stringProp name="script">System.out.println(prev.getResponseDataAsString());</stringProp>
+            </BeanShellPostProcessor>
+            <hashTree/>
           </hashTree>
           <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_GetRuleStatus" enabled="true">
             <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
@@ -291,7 +302,7 @@
             </JSONPathAssertion>
             <hashTree/>
             <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
-              <stringProp name="ConstantTimer.delay">5000</stringProp>
+              <stringProp name="ConstantTimer.delay">3000</stringProp>
             </ConstantTimer>
             <hashTree/>
           </hashTree>
@@ -370,7 +381,7 @@
             <hashTree/>
           </hashTree>
           <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
-            <stringProp name="ConstantTimer.delay">500</stringProp>
+            <stringProp name="ConstantTimer.delay">1000</stringProp>
           </ConstantTimer>
           <hashTree/>
         </hashTree>