-
Notifications
You must be signed in to change notification settings - Fork 331
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
[김대겸] Step2 PR #569
Merged
Merged
[김대겸] Step2 PR #569
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import http from 'k6/http'; | ||
import { check, group, sleep, fail } from 'k6'; | ||
|
||
export let options = { | ||
stages: [ | ||
{ duration: '30s', target: 5 }, | ||
{ duration: '5m', target: 6 }, | ||
{ duration: '4m', target: 7 }, | ||
{ duration: '20s', target: 9 }, | ||
{ duration: '5m', target: 9 }, | ||
{ duration: '10s', target: 7 }, | ||
{ duration: '10m', target: 6 }, | ||
{ duration: '5m', target: 0 }, | ||
], | ||
thresholds: { | ||
http_req_duration: ['p(99)<100'], | ||
}, | ||
}; | ||
|
||
const BASE_URL = 'https://gyeom-subway-admin.kro.kr/'; | ||
const USERNAME = 'koreatech93@naver.com'; | ||
const PASSWORD = 'tkatkatka05)%'; | ||
|
||
|
||
export default function () { | ||
mainPage(); | ||
const authHeaders = login(); | ||
retrieveMember(authHeaders); | ||
pathPage(); | ||
findPath(authHeaders); | ||
|
||
sleep(1); | ||
} | ||
|
||
|
||
function mainPage() { | ||
const response = http.get(BASE_URL); | ||
|
||
check(response, { | ||
'entered in main page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function login() { | ||
const payload = JSON.stringify({ | ||
email: USERNAME, | ||
password: PASSWORD, | ||
}); | ||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}; | ||
|
||
const response = http.post(`${BASE_URL}/login/token`, payload, params); | ||
|
||
check(response, { | ||
'logged in successfully': (res) => res.json('accessToken') !== '', | ||
}); | ||
|
||
return { | ||
headers: { | ||
Authorization: `Bearer ${response.json('accessToken')}`, | ||
}, | ||
}; | ||
} | ||
|
||
function retrieveMember(authHeaders) { | ||
let myObjects = http.get(`${BASE_URL}/members/me`, authHeaders).json(); | ||
check(myObjects, { 'retrieved member': (obj) => obj.id != 0 }); | ||
} | ||
|
||
function pathPage() { | ||
const response = http.get(`${BASE_URL}/path`); | ||
|
||
check(response, { | ||
'entered in path page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function findPath(authHeaders) { | ||
const response = http.get(`${BASE_URL}/path?source=3&target=4`, authHeaders); | ||
|
||
check(response, { | ||
'get path info successfully': (res) => res.status === 200 | ||
}); | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import http from 'k6/http'; | ||
import { check, group, sleep, fail } from 'k6'; | ||
|
||
export let options = { | ||
vus: 1, | ||
duration: '1m', | ||
|
||
thresholds: { | ||
http_req_duration: ['p(99)<100'], // 99% of requests must complete below 0.1s | ||
}, | ||
}; | ||
|
||
const BASE_URL = 'https://gyeom-subway-admin.kro.kr/'; | ||
const USERNAME = 'koreatech93@naver.com'; | ||
const PASSWORD = 'tkatkatka05)%'; | ||
|
||
|
||
export default function () { | ||
mainPage(); | ||
const authHeaders = login(); | ||
retrieveMember(authHeaders); | ||
pathPage(); | ||
findPath(authHeaders); | ||
|
||
sleep(1); | ||
} | ||
|
||
|
||
function mainPage() { | ||
const response = http.get(BASE_URL); | ||
|
||
check(response, { | ||
'entered in main page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function login() { | ||
const payload = JSON.stringify({ | ||
email: USERNAME, | ||
password: PASSWORD, | ||
}); | ||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}; | ||
|
||
const response = http.post(`${BASE_URL}/login/token`, payload, params); | ||
|
||
check(response, { | ||
'logged in successfully': (res) => res.json('accessToken') !== '', | ||
}); | ||
|
||
return { | ||
headers: { | ||
Authorization: `Bearer ${response.json('accessToken')}`, | ||
}, | ||
}; | ||
} | ||
|
||
function retrieveMember(authHeaders) { | ||
let myObjects = http.get(`${BASE_URL}/members/me`, authHeaders).json(); | ||
check(myObjects, { 'retrieved member': (obj) => obj.id != 0 }); | ||
} | ||
|
||
function pathPage() { | ||
const response = http.get(`${BASE_URL}/path`); | ||
|
||
check(response, { | ||
'entered in path page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function findPath(authHeaders) { | ||
const response = http.get(`${BASE_URL}/path?source=3&target=4`, authHeaders); | ||
|
||
check(response, { | ||
'get path info successfully': (res) => res.status === 200 | ||
}); | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import http from 'k6/http'; | ||
import { check, group, sleep, fail } from 'k6'; | ||
|
||
export let options = { | ||
stages: [ | ||
{ duration: '2m', target: 0 }, | ||
{ duration: '2m', target: 5 }, | ||
{ duration: '2m', target: 10 }, | ||
{ duration: '2m', target: 20 }, | ||
{ duration: '2m', target: 40 }, | ||
{ duration: '2m', target: 80 }, | ||
{ duration: '2m', target: 160 }, | ||
{ duration: '2m', target: 320 }, | ||
{ duration: '2m', target: 160 }, | ||
{ duration: '2m', target: 80 }, | ||
{ duration: '2m', target: 40 }, | ||
{ duration: '2m', target: 20 }, | ||
{ duration: '2m', target: 10 }, | ||
{ duration: '2m', target: 5 }, | ||
{ duration: '2m', target: 0 }, // ramp-down to 0 users | ||
], | ||
thresholds: { | ||
http_req_duration: ['p(99)<100'], | ||
}, | ||
}; | ||
|
||
|
||
const BASE_URL = 'https://gyeom-subway-admin.kro.kr/'; | ||
const USERNAME = 'koreatech93@naver.com'; | ||
const PASSWORD = 'tkatkatka05)%'; | ||
|
||
|
||
export default function () { | ||
mainPage(); | ||
const authHeaders = login(); | ||
retrieveMember(authHeaders); | ||
pathPage(); | ||
findPath(authHeaders); | ||
|
||
sleep(1); | ||
} | ||
|
||
|
||
function mainPage() { | ||
const response = http.get(BASE_URL); | ||
|
||
check(response, { | ||
'entered in main page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function login() { | ||
const payload = JSON.stringify({ | ||
email: USERNAME, | ||
password: PASSWORD, | ||
}); | ||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}; | ||
|
||
const response = http.post(`${BASE_URL}/login/token`, payload, params); | ||
|
||
check(response, { | ||
'logged in successfully': (res) => res.json('accessToken') !== '', | ||
}); | ||
|
||
return { | ||
headers: { | ||
Authorization: `Bearer ${response.json('accessToken')}`, | ||
}, | ||
}; | ||
} | ||
|
||
function retrieveMember(authHeaders) { | ||
let myObjects = http.get(`${BASE_URL}/members/me`, authHeaders).json(); | ||
check(myObjects, { 'retrieved member': (obj) => obj.id != 0 }); | ||
} | ||
|
||
function pathPage() { | ||
const response = http.get(`${BASE_URL}/path`); | ||
|
||
check(response, { | ||
'entered in path page successfully': (res) => res.status === 200 | ||
}); | ||
} | ||
|
||
function findPath(authHeaders) { | ||
const response = http.get(`${BASE_URL}/path?source=3&target=4`, authHeaders); | ||
|
||
check(response, { | ||
'get path info successfully': (res) => res.status === 200 | ||
}); | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
테스트 시나리오 잘 작성해주셨네요 👍🏻