Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
reviewPhotoMockData
} = require('./_mockData.js');

describe('Server tests', () => {
xdescribe('Server tests', () => {
before((done) => {
const app = require('../server/server.js');
server = app.server;
Expand Down
7 changes: 3 additions & 4 deletions k6/getReviews.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 100,
duration: '30s',
};

export default function () {
const low = 22000;
const high = 1000011;
const low = 900005;
const high = 1000005;
const id = Math.floor(Math.random() * (high - low)) + low;
http.get(`http://localhost:3000/reviews/${id}`);
http.get(`http://localhost:3000/reviews?product_id=${id}`);
sleep(1);
};
5 changes: 2 additions & 3 deletions k6/getReviewsMeta.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 100,
duration: '30s',
};

export default function () {
const low = 22000;
const low = 900000;
const high = 1000011;
const id = Math.floor(Math.random() * (high - low)) + low;
http.get(`http://localhost:3000/reviews/meta/${id}`);
http.get(`http://localhost:3000/reviews/meta?product_id=${id}`);
sleep(1);
};
28 changes: 28 additions & 0 deletions k6/postReview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
duration: '30s',
};

const newReview = {
product_id: 12,
rating: 4,
summary: "I am liking these glasses",
body: "They are very dark. But that's good because I'm in erysunny spots",
recommend: false,
name: "Mister Twister",
email: "mister@twister.com",
photos: ["google.com"],
characteristics: {
"42": 4,
"41": 2
},
};

export default function () {
const low = 900000;
const high = 1000011;
const id = Math.floor(Math.random() * (high - low)) + low;
http.post(`http://localhost:3000/reviews/`, newReview);
sleep(1);
};
13 changes: 13 additions & 0 deletions k6/putHelpful.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
duration: '30s',
};

const choices = [2, 6, 18, 19, 20];

export default function () {
const id = Math.floor(Math.random() * choices.length);
http.put(`http://localhost:3000/reviews/${choices[id]}/helpful`);
sleep(1);
};
13 changes: 13 additions & 0 deletions k6/putReport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
duration: '30s',
};

const choices = [2, 6, 18, 19, 20];

export default function () {
const id = Math.floor(Math.random() * choices.length);
http.put(`http://localhost:3000/reviews/${choices[id]}/report`);
sleep(1);
};
Loading