loadgenerator: revert locust settings
This commit is contained in:
parent
7d2ceb6c46
commit
f5505bb067
2 changed files with 25 additions and 57 deletions
|
@ -16,7 +16,17 @@
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from locust import HttpLocust, TaskSet
|
from locust import HttpLocust, TaskSet
|
||||||
import setting
|
|
||||||
|
products = [
|
||||||
|
'0PUK6V6EV0',
|
||||||
|
'1YMWWN1N4O',
|
||||||
|
'2ZYFJ3GM2N',
|
||||||
|
'66VCHSJNUP',
|
||||||
|
'6E92ZMYYFZ',
|
||||||
|
'9SIQT8TOJO',
|
||||||
|
'L9ECAV7KIM',
|
||||||
|
'LS4PSXUNUM',
|
||||||
|
'OLJCESPC7Z']
|
||||||
|
|
||||||
def index(l):
|
def index(l):
|
||||||
l.client.get("/")
|
l.client.get("/")
|
||||||
|
@ -27,13 +37,13 @@ def setCurrency(l):
|
||||||
{'currency_code': random.choice(currencies)})
|
{'currency_code': random.choice(currencies)})
|
||||||
|
|
||||||
def browseProduct(l):
|
def browseProduct(l):
|
||||||
l.client.get("/product/" + random.choice(setting.products))
|
l.client.get("/product/" + random.choice(products))
|
||||||
|
|
||||||
def viewCart(l):
|
def viewCart(l):
|
||||||
l.client.get("/cart")
|
l.client.get("/cart")
|
||||||
|
|
||||||
def addToCart(l):
|
def addToCart(l):
|
||||||
product = random.choice(setting.products)
|
product = random.choice(products)
|
||||||
l.client.get("/product/" + product)
|
l.client.get("/product/" + product)
|
||||||
l.client.post("/cart", {
|
l.client.post("/cart", {
|
||||||
'product_id': product,
|
'product_id': product,
|
||||||
|
@ -41,7 +51,18 @@ def addToCart(l):
|
||||||
|
|
||||||
def checkout(l):
|
def checkout(l):
|
||||||
addToCart(l)
|
addToCart(l)
|
||||||
l.client.post("/cart/checkout", random.choice(setting.orders))
|
l.client.post("/cart/checkout", {
|
||||||
|
'email': 'someone@example.com',
|
||||||
|
'street_address': '1600 Amphitheatre Parkway',
|
||||||
|
'zip_code': '94043',
|
||||||
|
'city': 'Mountain View',
|
||||||
|
'state': 'CA',
|
||||||
|
'country': 'United States',
|
||||||
|
'credit_card_number': '4432-8015-6152-0454',
|
||||||
|
'credit_card_expiration_month': '1',
|
||||||
|
'credit_card_expiration_year': '2019',
|
||||||
|
'credit_card_cvv': '672',
|
||||||
|
})
|
||||||
|
|
||||||
class UserBehavior(TaskSet):
|
class UserBehavior(TaskSet):
|
||||||
|
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
#
|
|
||||||
# Copyright 2018 Google LLC
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
products = [
|
|
||||||
'0PUK6V6EV0',
|
|
||||||
'1YMWWN1N4O',
|
|
||||||
'2ZYFJ3GM2N',
|
|
||||||
'66VCHSJNUP',
|
|
||||||
'6E92ZMYYFZ',
|
|
||||||
'9SIQT8TOJO',
|
|
||||||
'L9ECAV7KIM',
|
|
||||||
'LS4PSXUNUM',
|
|
||||||
'OLJCESPC7Z']
|
|
||||||
|
|
||||||
orders = [
|
|
||||||
{
|
|
||||||
'email': 'someone@example.com',
|
|
||||||
'street_address': '1600 Amphitheatre Parkway',
|
|
||||||
'zip_code': '94043',
|
|
||||||
'city': 'Mountain View',
|
|
||||||
'state': 'CA',
|
|
||||||
'country': 'United States',
|
|
||||||
'credit_card_number': '4432-8015-6152-0454',
|
|
||||||
'credit_card_expiration_month': '1',
|
|
||||||
'credit_card_expiration_year': '2019',
|
|
||||||
'credit_card_cvv': '672',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'email': 'anyone@example.com',
|
|
||||||
'street_address': '6-10-1 Roppongi, Roppongi Hills 44F',
|
|
||||||
'zip_code': '1066126',
|
|
||||||
'city': 'Minato-ku',
|
|
||||||
'state': 'Tokyo',
|
|
||||||
'country': 'Japapn',
|
|
||||||
'credit_card_number': '4429-3499-0001-7938',
|
|
||||||
'credit_card_expiration_month': '4',
|
|
||||||
'credit_card_expiration_year': '2021',
|
|
||||||
'credit_card_cvv': '124',
|
|
||||||
}
|
|
||||||
]
|
|
Loading…
Add table
Add a link
Reference in a new issue