'Locust endpoint authentication failing unless another endpoint is also called

so I was trying to load test a Kerberos authenticated endpoint using the below locustfile (details removed):

from locust import HttpUser, TaskSet, task
from requests_kerberos import HTTPKerberosAuth


class UserBehaviour(TaskSet):

    @task
    def method1(self):
        self.client.post("/method1", auth=HTTPKerberosAuth(force_preemptive=True), json={})


class FilterAndPrioritiseUser(HttpUser):
    tasks = [UserBehaviour]

Then I continually get an error saying SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'), even though I can manually hit the endpoint fine.

However, if I add another task:

    @task(1)
    def method2(self):
        self.client.get("/endpoint2", verify=False)

Then the results look like this:

Type    Name        # Requests  # Fails 
GET     /endpoint2  6           6   
POST    /endpoint1  19          4   

Where the errors are:

# fails Method  Name        Type
6       GET     /method2    HTTPError('401 Client Error: Unauthorized for url')
4       POST    /method1    SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')

This makes no sense, as why does this other endpoint being hit and failing for the being unauthorised cause the original endpoint to stop failing after a few retries?

Any help would be very appreciated as I'm very confused!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source