Pause a ramping-vus test execution then resume it by terminal command

As I was checking, k6 provides load testers to pause/resume a live running test (as per docu: How to control a live k6 test, with these built-in commands

Please see my set up.

export const options = {

    ext: {
        loadimpact: {
            projectID: 1234,
            // Test runs with the same name groups test runs together
            name: "test",

            distribution: {
                "amazon:sg:singapore": {
                    loadZone: "amazon:sg:singapore",
                    percent: 100,
                },
            },

        }
    },

    stages: [
        { duration: "1m", target: 150 },
        { duration: "3m", target: 150 },
        { duration: "1m", target: 0 },
    ],

};


export default function() {
    let response;
    const vars = {};

    response = http.get(https://test.com);
    sleep(5);
}

Please note also that I am running the output on the k6 cloud.

After running the test…I tried making use of the k6 pause command. I opened a new terminal and entered the command : k6 pause …but it displayed an error.

ERRO[0000] Pause error: ramping-vus executor ‘default’ doesn’t support pause and resume operations after its start

Is there a way for me to work this out? I need to manually pause the live test and resume it whenever I want to.

OR is there a way from k6 wherein we can add a line in the script that will automatically pause the execution after a condition is met. For example. Pause the execution after all VUs were able to iterate one time. Then I can resume the test manually whenever I want to by inputting a command (for example: k6 resume).

Any help or discussion is much appreciated. Thanks.

Additional: I also tried the given exact example of k6 from their pause/resume docu and encountered same error. I am not sure if there is a problem on k6 side itself or what.

k6 sample:

My error:

Hi there,

as the error message says, this behavior is not supported for the ramping-vus executor, and is only possible using the externally-controlled executor. This is partly because of legacy reasons, and also because it would be difficult to take external input into account when running with more complex executors like ramping-arrival-rate.

I see the benefit of this being a property of any executor that could support it (at first thought I don’t see a reason why ramping-vus couldn’t) instead of a standalone executor, but it wouldn’t be trivial to implement. Maybe @ned or other k6 devs can comment on this.

In the meantime, if you switch to the externally-controlled executor you could write a shell script that replicates the ramping VU behavior you need, allowing you to run k6 pause and k6 resume as needed. It’s far from ideal, but I think it’s the best possible approach right now.

In theory, any of the existing executors can be made pause-able. In practice, we haven’t done that because it will add a ton of complexity and potentially even some performance degradation… We might accept a PR for this if it’s of a sufficiently high quality and well tested, but we’re probably not going to work on it any time soon.

Re:

Thanks for pointing this out, this was an old k6 blog article from before k6 v0.27.0, when we made these breaking changes. We’ll fix it or add a note in it that the content is no longer accurate.