Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When there is an error in the FAILURES of the front-end page when there is a worker, there is no escape. #2674

Closed
2 tasks done
GeraldWhitehead opened this issue Apr 15, 2024 · 7 comments · Fixed by #2710
Closed
2 tasks done
Labels

Comments

@GeraldWhitehead
Copy link

GeraldWhitehead commented Apr 15, 2024

Prerequisites

Description

I'm using locust with 2.25.0 and have the same problem on 2.24.1, when I run locust -f 1_gloria_test.py --web-login, there is an error reported, and the page data displays fine as follows
image
But when I have a worker, the page doesn't show the data correctly.
master: locust -f 1_gloria_test.py --master
worker: locust -f 1_gloria_test.py --worker
After running, the front-end data looks like this
image

Command line

locust -f 1_gloria_test.py --master

Locustfile contents

import jmespath
from locust import HttpUser, task, TaskSet


class UserStressTest(TaskSet):

    @task(1)
    def task_3_1(self):

        request = {'method': 'GET', 'path': '/cg/v1/case/group/1',
                   'header': {'token': '5153abd76ae0a492beb2ee5f37b91035', 'Content-Type': 'application/json'},
                   'data': {}}

        with self.client.get(request['path'], headers=request['header'], params=None, timeout=10,
                             catch_response=True) as response:

            resp = {
                "status_code": response.status_code,
                "headers": response.headers,
                "body": response.json()}
            try:
                # 断言
                assert jmespath.search('status_code', resp) in [200], {resp['status_code']}
                assert jmespath.search('body.data[0].name', resp) in ['test'], f"断言失败,返回值:{resp['body']}"

            except Exception as ex:
                response.failure(ex)


class TestLocustFile(HttpUser):
    host = "http://127.0.0.1:9998"
    tasks = [UserStressTest]

Python version

3.11.0

Locust version

2.25.0

Operating system

amzn2023.x86_64

@cyberw
Copy link
Collaborator

cyberw commented Apr 15, 2024

Hi!

There's a ton of stuff going on in your locsustfile :)

Can you remove everything that isnt relevant to your problem? Simplify it to something like:

class AuthUser(UserMixin):
    @task
    def t(self):
        with self.client.post(..., catch_response=True) as response:
            assert False, "<message that breaks the UI>"

@GeraldWhitehead
Copy link
Author

Hi!

There's a ton of stuff going on in your locsustfile :)

Can you remove everything that isnt relevant to your problem? Simplify it to something like:

class AuthUser(UserMixin):
    @task
    def t(self):
        with self.client.post(..., catch_response=True) as response:
            assert False, "<message that breaks the UI>"

HI
Simplifications have been made and problems remain

@cyberw
Copy link
Collaborator

cyberw commented Apr 15, 2024

Thanks! I will investigate. Probably this weekend or something...

@GeraldWhitehead
Copy link
Author

Thanks

Thanks

@GeraldWhitehead
Copy link
Author

Thanks! I will investigate. Probably this weekend or something...

Any results on this question, please? Now every time I get an error it affects my viewing of the error message!

cyberw added a commit that referenced this issue May 12, 2024
Fixes #2674, at least the most annoying part of it.
@cyberw
Copy link
Collaborator

cyberw commented May 13, 2024

Try with the latest prerelease build now (pip install --pre -U locust). I tried to fix it in #2710 and #2712.

@GeraldWhitehead
Copy link
Author

pip install --pre -U locust

Verified, problem fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants