-
Notifications
You must be signed in to change notification settings - Fork 10
API Proxy for UI Tests #6927
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
Merged
Merged
API Proxy for UI Tests #6927
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
49f6024
Test changes
dmohs c7d0f45
parameterize proxy URL
dmohs 9d5dbe4
API proxy
dmohs fcec2f4
use API proxy
dmohs 4ab0884
handlers
dmohs c810821
startproxy.sh
dmohs 771a0de
fix and disable deploy
dmohs d1847ac
silence proxy logs for now
dmohs dab99dc
Silence the correct fd
dmohs 5806e94
re-enable deploy job
dmohs 7e847a6
Rename handlers to path-first
dmohs 4192a2d
Misc fixes
dmohs d22a653
Update proxy launcher
dmohs 8a3f82c
README
dmohs 159e844
formatResBody
dmohs dc3b09d
Remove host check
dmohs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,19 @@ | ||
const matchReq = req => req.method === 'OPTIONS' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only handler that is hand-edited. All of the OPTIONS method responses were basically identical, so I consolidated them into one file. |
||
|
||
const headers = { | ||
'access-control-allow-credentials': 'true', | ||
'access-control-allow-origin': '*', | ||
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS', | ||
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization', | ||
vary: 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', | ||
allow: 'GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH', | ||
'content-type': 'text/html', | ||
server: 'Google Frontend' | ||
} | ||
|
||
const handleReq = (req, res) => { | ||
if (!matchReq(req)) { return } | ||
Object.keys(headers).forEach(h => res.setHeader(h, headers[h])) | ||
res.status(200).mend() | ||
} | ||
export default handleReq |
This file contains hidden or 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,7 @@ | ||
const handleReq = (req, res) => { | ||
if (!(req.url.pathname === '/' | ||
&& req.url.search === '' | ||
&& req.method === 'GET')) { return } | ||
res.mwrite(`AllOfUs Workbench API`).mend() | ||
} | ||
export default handleReq |
This file contains hidden or 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,102 @@ | ||
const matchReq = req => | ||
req.url.pathname === '/v1/cdrVersionsByTier' | ||
&& req.url.search === '' | ||
&& req.method === 'GET' | ||
|
||
const body = JSON.stringify( | ||
{ | ||
tiers: [ | ||
{ | ||
accessTierShortName: 'controlled', | ||
accessTierDisplayName: 'Controlled Tier', | ||
defaultCdrVersionId: '5', | ||
defaultCdrVersionCreationTime: 1598400591000, | ||
versions: [ | ||
{ | ||
cdrVersionId: '5', | ||
name: 'Synthetic Dataset in the Controlled Tier', | ||
accessTierShortName: 'controlled', | ||
archivalStatus: 'LIVE', | ||
hasWgsData: true, | ||
hasFitbitData: true, | ||
hasCopeSurveyData: true, | ||
creationTime: 1598400591000 | ||
} | ||
] | ||
}, | ||
{ | ||
accessTierShortName: 'registered', | ||
accessTierDisplayName: 'Registered Tier', | ||
defaultCdrVersionId: '3', | ||
defaultCdrVersionCreationTime: 1569801600000, | ||
versions: [ | ||
{ | ||
cdrVersionId: '4', | ||
name: '[Removed] Synthetic Dataset v3 with Microarray', | ||
accessTierShortName: 'registered', | ||
archivalStatus: 'ARCHIVED', | ||
hasWgsData: false, | ||
hasFitbitData: true, | ||
hasCopeSurveyData: true, | ||
creationTime: 1598400591000 | ||
}, | ||
{ | ||
cdrVersionId: '6', | ||
name: '[Removed] Synthetic Dataset v3 with WGS', | ||
accessTierShortName: 'registered', | ||
archivalStatus: 'ARCHIVED', | ||
hasWgsData: false, | ||
hasFitbitData: false, | ||
hasCopeSurveyData: false, | ||
creationTime: 1598400591000 | ||
}, | ||
{ | ||
cdrVersionId: '2', | ||
name: 'Synthetic Dataset v2', | ||
accessTierShortName: 'registered', | ||
archivalStatus: 'LIVE', | ||
hasWgsData: false, | ||
hasFitbitData: true, | ||
hasCopeSurveyData: true, | ||
creationTime: 1569801600000 | ||
}, | ||
{ | ||
cdrVersionId: '3', | ||
name: 'Synthetic Dataset v3', | ||
accessTierShortName: 'registered', | ||
archivalStatus: 'LIVE', | ||
hasWgsData: false, | ||
hasFitbitData: true, | ||
hasCopeSurveyData: true, | ||
creationTime: 1569801600000 | ||
}, | ||
{ | ||
cdrVersionId: '1', | ||
name: '[Removed] Synthetic Dataset v1', | ||
accessTierShortName: 'registered', | ||
archivalStatus: 'ARCHIVED', | ||
hasWgsData: false, | ||
hasFitbitData: false, | ||
hasCopeSurveyData: false, | ||
creationTime: 1528243200000 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
) | ||
|
||
const headers = { | ||
'access-control-allow-credentials': 'true', | ||
'access-control-allow-origin': '*', | ||
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS', | ||
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization', | ||
'content-type': 'application/json' | ||
} | ||
|
||
const handleReq = (req, res) => { | ||
if (!matchReq(req)) { return } | ||
Object.keys(headers).forEach(h => res.setHeader(h, headers[h])) | ||
res.status(200).mwrite(body).mend() | ||
} | ||
export default handleReq |
This file contains hidden or 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,112 @@ | ||
const matchReq = req => | ||
req.url.pathname === '/v1/config' | ||
&& req.url.search === '' | ||
&& req.method === 'GET' | ||
|
||
const body = JSON.stringify( | ||
{ | ||
gsuiteDomain: 'fake-research-aou.org', | ||
projectId: 'all-of-us-workbench-test', | ||
firecloudURL: 'https://firecloud-orchestration.dsde-dev.broadinstitute.org', | ||
publicApiKeyForErrorReports: 'AIzaSyDPoX4Eg7-_FVKi7JFzEKaJpZ4IMRLaER4', | ||
shibbolethUiBaseUrl: 'https://broad-shibboleth-prod.appspot.com/dev', | ||
enableComplianceTraining: true, | ||
complianceTrainingHost: 'aoudev.nnlm.gov', | ||
enableEraCommons: true, | ||
unsafeAllowSelfBypass: true, | ||
defaultFreeCreditsDollarLimit: 300, | ||
enableEventDateModifier: false, | ||
enableResearchReviewPrompt: false, | ||
enableRasLoginGovLinking: true, | ||
enforceRasLoginGovLinking: true, | ||
enableGenomicExtraction: true, | ||
enableGpu: true, | ||
enablePersistentDisk: true, | ||
enableUniversalSearch: true, | ||
enableMultiReview: true, | ||
enableDrugWildcardSearch: false, | ||
rasHost: 'https://stsstg.nih.gov', | ||
accessRenewalLookback: 330, | ||
complianceTrainingRenewalLookback: 30, | ||
rasClientId: 'e5c5d714-d597-48c8-b564-a249d729d0c9', | ||
rasLogoutUrl: 'https://authtest.nih.gov/siteminderagent/smlogoutredirector.asp?TARGET=', | ||
runtimeImages: [], | ||
freeTierBillingAccountId: '013713-75CFF6-1751E5', | ||
accessModules: [ | ||
{ | ||
name: 'ERA_COMMONS', | ||
expirable: false, | ||
bypassable: true, | ||
requiredForRTAccess: false, | ||
requiredForCTAccess: false | ||
}, | ||
{ | ||
name: 'TWO_FACTOR_AUTH', | ||
expirable: false, | ||
bypassable: true, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'RAS_LINK_LOGIN_GOV', | ||
expirable: false, | ||
bypassable: true, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'COMPLIANCE_TRAINING', | ||
expirable: true, | ||
bypassable: true, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'DATA_USER_CODE_OF_CONDUCT', | ||
expirable: true, | ||
bypassable: true, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'PROFILE_CONFIRMATION', | ||
expirable: true, | ||
bypassable: false, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'PUBLICATION_CONFIRMATION', | ||
expirable: true, | ||
bypassable: false, | ||
requiredForRTAccess: true, | ||
requiredForCTAccess: true | ||
}, | ||
{ | ||
name: 'CT_COMPLIANCE_TRAINING', | ||
expirable: true, | ||
bypassable: true, | ||
requiredForRTAccess: false, | ||
requiredForCTAccess: true | ||
} | ||
], | ||
currentDuccVersions: [ 3, 4, 5 ], | ||
enableUpdatedDemographicSurvey: true | ||
} | ||
) | ||
|
||
const headers = { | ||
'access-control-allow-credentials': 'true', | ||
'access-control-allow-origin': '*', | ||
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS', | ||
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization', | ||
'content-type': 'application/json', | ||
server: 'Google Frontend' | ||
} | ||
|
||
const handleReq = (req, res) => { | ||
if (!matchReq(req)) { return } | ||
Object.keys(headers).forEach(h => res.setHeader(h, headers[h])) | ||
res.status(200).mwrite(body).mend() | ||
} | ||
export default handleReq |
This file contains hidden or 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,30 @@ | ||
const matchReq = req => | ||
req.url.pathname === '/v1/disks/aou-rw-test-ca61ee0f' | ||
&& req.url.search === '' | ||
&& req.method === 'GET' | ||
|
||
const body = JSON.stringify( | ||
{ | ||
message: 'Active PD with prefix all-of-us-pd-4451 not found in workspace aou-rw-test-ca61ee0f', | ||
statusCode: 404, | ||
errorClassName: 'org.pmiops.workbench.exceptions.NotFoundException', | ||
errorCode: null, | ||
errorUniqueId: '584d7b0f-6097-42d4-9160-1be80eab911b', | ||
parameters: null | ||
} | ||
) | ||
|
||
const headers = { | ||
'access-control-allow-credentials': 'true', | ||
'access-control-allow-origin': '*', | ||
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS', | ||
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization', | ||
'content-type': 'application/json' | ||
} | ||
|
||
const handleReq = (req, res) => { | ||
if (!matchReq(req)) { return } | ||
Object.keys(headers).forEach(h => res.setHeader(h, headers[h])) | ||
res.status(404).mwrite(body).mend() | ||
} | ||
export default handleReq |
23 changes: 23 additions & 0 deletions
23
api-proxy/handlers/|v1|getUserTermsOfServiceStatus.get.mjs
This file contains hidden or 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,23 @@ | ||
const matchReq = req => | ||
req.url.pathname === '/v1/getUserTermsOfServiceStatus' | ||
&& req.url.search === '' | ||
&& req.method === 'GET' | ||
|
||
const body = JSON.stringify( | ||
true | ||
) | ||
|
||
const headers = { | ||
'access-control-allow-credentials': 'true', | ||
'access-control-allow-origin': '*', | ||
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS', | ||
'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization', | ||
'content-type': 'application/json' | ||
} | ||
|
||
const handleReq = (req, res) => { | ||
if (!matchReq(req)) { return } | ||
Object.keys(headers).forEach(h => res.setHeader(h, headers[h])) | ||
res.status(200).mwrite(body).mend() | ||
} | ||
export default handleReq |
Oops, something went wrong.
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.
If we go with this approach, I will delete the unused PR site configuration files.