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

Bug in StagesShapeWithCustomUsers #2358

Closed
Elvintest opened this issue Jun 7, 2023 · 0 comments
Closed

Bug in StagesShapeWithCustomUsers #2358

Elvintest opened this issue Jun 7, 2023 · 0 comments
Labels

Comments

@Elvintest
Copy link

Elvintest commented Jun 7, 2023

for stage in self.stages:

Hello, I tried your code in distributing stages, in this version it has one disadvantage - we can not switch to another stage cause run_time in the rest of cases will be more than stage_duration:

            if run_time < stage["duration"]
                try:
                    tick_data = (stage["users"], stage["spawn_rate"], stage["user_classes"])
                except:
                    tick_data = (stage["users"], stage["spawn_rate"])
                return tick_data

So to switch our test to another stage but at the same time to keep the feature of stopping our test i would offer you to try this solution:

    def tick(self):
        run_time = self.get_run_time()
        duration = 0
        for stage in self.stages:
            duration +=stage["duration"]
            if run_time < duration:
                try:
                    tick_data = (stage["users"], stage["spawn_rate"], stage["user_classes"])
                except:
                    tick_data = (stage["users"], stage["spawn_rate"])
                return tick_data
        return None

In my version we check that common run_time doesn't exceed duration of previous stages and incoming new one

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

No branches or pull requests

1 participant