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

Consolidated script options include the Go struct fields #886

Closed
na-- opened this issue Dec 27, 2018 · 0 comments · Fixed by #1151
Closed

Consolidated script options include the Go struct fields #886

na-- opened this issue Dec 27, 2018 · 0 comments · Fixed by #1151

Comments

@na--
Copy link
Member

na-- commented Dec 27, 2018

Running the following script with k6, with or without specifying the vus via the CLI flag:

export let options = {
    vus: 5,
};

export default function () {
    console.log("vus normal", options.vus);
    console.log("vus typeof", typeof options.vus);
    console.log("vus JSON.stringify", JSON.stringify(options.vus));
    console.log("vus properties", Object.getOwnPropertyNames(options.vus));
    console.log("vus .value()", options.vus.value());
}

will produce something like this:

INFO[0001] vus normal                                    0="[object Object]"
INFO[0001] vus typeof                                    0=object
INFO[0001] vus JSON.stringify                            0=5
INFO[0001] vus properties                                0="null_int64,int64,valid,isZero,marshalJSON,marshalText,ptr,value,valueOrZero"
INFO[0001] vus .value()                                  0=5

Instead, vus should be a plain number. This seems like a regression that likely was caused by #681 or #713, since k6 v0.22.1 is the first k6 version that doesn't work as expected, k6 v0.22.0 produces the following correct result:

INFO[0000] vus normal                                    0=5
INFO[0000] vus typeof                                    0=number
INFO[0000] vus JSON.stringify                            0=5
INFO[0000] vus properties                                0=
ERRO[0000] TypeError: Object has no member 'value'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants