-
Notifications
You must be signed in to change notification settings - Fork 186
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
[Tests-Only] Add k6 tests for deleting and downloading a file #959
Conversation
@fschade, I have added tests for some simple file operations, I noticed that in the existing tests the created files were not being cleaned up, so I have added that too. currently, all the "VU"'s on the tests are basically the same user (i.e. einstein) sending requests simultaneously, I guess, next, we will have to implement creating different user accounts for different VUs and send request from different user accounts. What do you think, am I on the right track? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found some smaller things, not mandetory but nice to have :)
tests/k6/src/test-issue-162.ts
Outdated
check(res, { | ||
// status could be either 204(if file was created) of 404(if file was not uploaded) | ||
'status is 204 or 404': () => [204, 404].includes(res.status), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my opinion we should check the 204 and 404 individually and not within one check. Why do we expect 404 at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fschade , when trying with large number of users, the upload requests fail, so some file are not created.
For. eg when trying with 500 vus and 100 iterations I get
✗ status is 201
↳ 78% — ✓ 785 / ✗ 215
Also I could not get the list of failed uploads here from default function, which would be easier.
checking each of them separately still gives error on one of the checks so cant do that either
tests/k6/src/test-delete-file.ts
Outdated
for (let vu=1; vu <= options.vus; vu++) { | ||
for (let iter=0; iter < options.iterations/options.vus; iter++) { | ||
const res = api.uploadFile(defaults.accounts.einstein, files['kb_50.jpg'], `deletefile_${vu}_${iter}.jpg`) | ||
check(res, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if something goes wrong here it doesnt break and the default export still will run. it could be better do do a breacking check here.
tests/k6/src/test-delete-file.ts
Outdated
console.log("setup for delete") | ||
for (let vu=1; vu <= options.vus; vu++) { | ||
for (let iter=0; iter < options.iterations/options.vus; iter++) { | ||
const res = api.uploadFile(defaults.accounts.einstein, files['kb_50.jpg'], `deletefile_${vu}_${iter}.jpg`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its easier for later refference to keep the filenames in a shared hash. this whay we can loop over it in future test steps.
// 1. init code
export function setup() {
const images: string[];
...
return {images}
}
export default function (data) {
data.images.forEach(i => console.log(i))
}
export function teardown(data) {
data.images.forEach(i => console.log(i))
}
e2c980b
to
4db4cfb
Compare
@dpakach there are conflicts. Needs a rebase... |
Kudos, SonarCloud Quality Gate passed! |
Many of these tests have been covered in #983, I'll do other tests on a different PR. So closing this for now |
Add simple K6 tests for
the number of iterations and VUs can be changed on the test file easily