0

First time caller long time listener :)

I'm running a locust test on a site (or at least trying) but getting 100% failure with the following error

1

from locust import HttpLocust, TaskSet, task, between from locust.events import request_success import logging, contextlib, requests try: from http.client import HTTPConnection # py3 except ImportError: from httplib import HTTPConnection # py2

def debug_requests_on(): '''Switches on logging of the requests module.''' HTTPConnection.debuglevel = 1

    logging.basicConfig()
    logging.getLogger().setLevel(logging.DEBUG)
    requests_log = logging.getLogger("requests.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True

def call_hook(resp, *args, **kwargs): print(f"{resp.url} returned status code of {resp.status_code}")

class RedirectTaskSet(TaskSet):

def on_start(self):
    pass

def on_stop(self):
    pass

@task
def redirect_task(self):
    name = '/voting'
    response =  self.client.get('/voting', allow_redirects=True, name=name)
    print("Response status code:", response.status_code)
    print("Response history:", response.history)

    if not response.ok:
        self.log_failure('Request failed ', name, response)

def log_failure(self, message, name, response):
    pass # add some logging

#@task
#def log_response_codes(self):
#    requests.get('https://thevoice.com.au/voting', hooks={'response': call_hook})

class RedirectLocust(HttpLocust):

task_set = RedirectTaskSet
wait_time = between(0.5,3)
host = "https://www.thevoice.com.au"
#debug_requests_on()
Shady Ayad
  • 11
  • 2
  • Hi! You need to provide more details (like your load test script) for someone to be able to help you. The error typically means that host name in the url you specified could not be found (www.thevoice.com.au does not exist) – Cyberwiz May 06 '20 at 12:51
  • Thanks for responding cyberwiz :) I've added the locustfile.py to my question. The site loads it's a redirect and we want to load test the redirect. – Shady Ayad May 06 '20 at 23:29

1 Answers1

0

Thanks for adding your test plan. The problem is that thevoice.com.au cannot be resolved (has no DNS entry). It is unrelated to locust. You can try it using curl, ping, or whatever other tool to confirm.

~ curl https://www.thevoice.com.au
curl: (6) Could not resolve host: www.thevoice.com.au
Cyberwiz
  • 11,027
  • 3
  • 20
  • 40
  • SO I have found that if i keep my user load below 200 it's fine but as soon as i go to 300 plus it gives me that error my limit open file limit is set to 5000. wondering if it could be something to do with AV which is a corporate (can't disable) Ps thank you so much for looking into this – Shady Ayad May 07 '20 at 09:36
  • You might try replacing the dns name with an ip adress (like 1.2.3.4), if you are running into some kind of DNS throttling. – Cyberwiz May 07 '20 at 13:20
  • Actually I got the same error just now (when increasing the load). Are you running on MacOS? Have you tried switching to FastHttpUser? Can you edit your question to focus on this issue (the increased load) – Cyberwiz May 08 '20 at 09:42
  • 1
    found a solution basically adding the following line to my Locustfile.py resource.setrlimit(resource.RLIMIT_NOFILE, (20000, 21000)) – Shady Ayad May 09 '20 at 01:38