Update the user guide and script about performance test 18/10518/1
authorZhang Rong(Jon) <rong.zhang@windriver.com>
Wed, 22 Feb 2023 03:48:06 +0000 (11:48 +0800)
committerZhang Rong(Jon) <rong.zhang@windriver.com>
Wed, 22 Feb 2023 03:48:06 +0000 (11:48 +0800)
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: Iba6e7de4840353f25aa92599c905050134973284

tests/locust/README.md
tests/locust/ocloud.py

index 21f12f2..d4bf4bb 100644 (file)
@@ -6,29 +6,38 @@ Here is the sample command to run one master worker with 7 sub worker
 
 ```bash
 # main worker:  
-locust -f ocloud.py -H http://128.224.115.34:30205 --master
+export SMO_TOKEN_DATA=<SMO token data>
+locust -f ocloud.py -H https://128.224.115.34:30205 --master
 
 # worker_1:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_2:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_3:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_4:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_5:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_6:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 #worker_7:  
+export SMO_TOKEN_DATA=<SMO token data>
 locust -f ocloud.py --worker
 ```
 
 If you can use goreman to run [goreman](github.com/mattn/goreman), feel free to use it.
 
 ```bash
+export SMO_TOKEN_DATA=<SMO token data>
 cat <<EOF >>Procfile
-ocloud:  locust -f ocloud.py -H http://128.224.115.34:30205 --master
+ocloud:  locust -f ocloud.py -H https://128.224.115.34:30205 --master
 ocloud_1:  locust -f ocloud.py --worker
 ocloud_2:  locust -f ocloud.py --worker
 ocloud_3:  locust -f ocloud.py --worker
index 84f4659..2aec696 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+import os
 from locust import HttpUser, task, constant
 
+# bearer_token="Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkJJb3A2V2JSb29nNjR2YnpzOE12VXpzRHJVNjVSLUp1dWhZX2kzV0hjc2cifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InNtby10b2tlbi1xNjcyZyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJzbW8iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiIwNmQzNDY1Ny0yZGFlLTQyNDItODMzMC05OTI4MjFmYzk0N2UiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6ZGVmYXVsdDpzbW8ifQ.PbDAaLwi4OdQ4CZUFa1TC2vP0IWJqTP2ECmv287uHCho4vpZU63pkS2SgdtbDHLbPK29wZKJ1q9mqv4fci2WdJ7w87sfbHT1dcC8VzfAq7aQ4Rx6xRtsnTmerWqgsXYF_JqpfpHQFVO2stkV5zvg902J5Yco09xez0V6tIGNNORyBXc0SrQ7nuyMoH4gxAunfE_nFB5bQd9dfJnD7gHdDmh2v0HzKEnOV2KUJVhVLGnXZRJmYq1hoDc9YrJRoXmGucescnMDqUh0t8bwVG5a0BQZlLcc1y7i3WXUWPbXsmJ-7RN2_jYERUlS70SmOfaKNSC-t2BvGuh1lmF6yQaoKA"
+bearer_token="Bearer "+os.environ.get("SMO_TOKEN_DATA", "")
 
 class QuickstartUser(HttpUser):
     wait_time = constant(0)
 
     @task
     def ocloud(self):
-        self.client.get("/o2ims_infrastructureInventory/v1/")
+        self.client.get("/o2ims-infrastructureInventory/v1/")
 
     @task
     def resource(self):
         resp = self.client.get(
-            "/o2ims_infrastructureInventory/v1/resourcePools")
+            "/o2ims-infrastructureInventory/v1/resourcePools")
         json_resp_dict = resp.json()
         self.client.get(
-            "/o2ims_infrastructureInventory/v1/resourcePools/%s/resources" %
+            "/o2ims-infrastructureInventory/v1/resourcePools/%s/resources" %
             json_resp_dict[0]['resourcePoolId'])
 
     @task
     def dms(self):
-        self.client.get("/o2ims_infrastructureInventory/v1/deploymentManagers")
+        self.client.get("/o2ims-infrastructureInventory/v1/deploymentManagers")
 
     def on_start(self):
-        pass
+        self.client.headers = {
+            'Authorization':bearer_token
+        }
+        self.client.verify = False