-
Notifications
You must be signed in to change notification settings - Fork 323
Feature/create temp clouds for tests #372
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
Changes from all commits
632c394
0b7d3d8
3721d31
20a2985
933f9e2
e6a8929
9a9ac0b
5060a8d
7f9fa46
e70d83b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,8 @@ describe('account API - Provisioning', function () { | |
| before("Setup the required test", async function () { | ||
| let config = cloudinary.config(true); | ||
| if (!(config.provisioning_api_key && config.provisioning_api_secret && config.account_id)) { | ||
| expect().fail("Missing key and secret. Please set CLOUDINARY_ACCOUNT_URL."); | ||
| // For external PRs the env variables are not availble, so we skip the provisioning API | ||
| this.skip(); | ||
| } | ||
|
|
||
| let CLOUD_TO_CREATE = CLOUD_NAME_PREFIX + Date.now(); | ||
|
|
@@ -53,6 +54,12 @@ describe('account API - Provisioning', function () { | |
| }); | ||
|
|
||
| after('Destroy the sub_account and user that was created', async () => { | ||
| // Skip 'after' in case we don't have account configuration available | ||
| // This means that the beforeHook also didn't run | ||
| let config = cloudinary.config(true); | ||
| if (!(config.provisioning_api_key && config.provisioning_api_secret && config.account_id)) { | ||
| return; | ||
| } | ||
| let delRes = await cloudinary.provisioning.account.delete_sub_account(CLOUD_ID); | ||
|
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. Don't we have a cron job for handling this? 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 for the provisioning API test, which creates clouds for its own testing, (as part of the functionality is the ability to create/destroy clouds) Our usual tests depend on a cloud to exist, for that we have the create/destroy automation in place. The provisioning API depends on the creation/destruction of clouds itself. |
||
| let delUserRes = await cloudinary.provisioning.account.delete_user(USER_ID); | ||
| let delGroupRes = await cloudinary.provisioning.account.delete_user_group(GROUP_ID); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /** | ||
| * This file when used as a script (node tmp.js) will create a new cloud within Cloudinary | ||
| * The CLOUDINARY_URL environment variable string is created, and stored in ./cloudinary_url.sh | ||
| * To use a fresh cloud in your tests, source ./cloudinary_url.sh before running the tests | ||
| * Example: node tools/createTestCloud && source tools/cloudinary_url.sh && npm run test | ||
| */ | ||
|
|
||
| const fs = require('fs'); | ||
| let https = require('https'); | ||
|
|
||
| let req = https.request({ | ||
| method: 'POST', | ||
| hostname: 'sub-account-testing.cloudinary.com', | ||
| path: '/create_sub_account', | ||
| port: 443, | ||
| }, (res) => { | ||
| let data = ''; | ||
| res.on('data', (d) => { | ||
| data += d; | ||
| }); | ||
|
|
||
| res.on('end', () => { | ||
| let cloudData = JSON.parse(data); | ||
| let { payload: { cloudApiKey, cloudApiSecret, cloudName, id } } = cloudData; | ||
| let URL = `CLOUDINARY_URL=cloudinary://${cloudApiKey}:${cloudApiSecret}@${cloudName}`; | ||
|
|
||
| fs.writeFileSync(`tools/cloudinary_url.sh`, URL); | ||
| }); | ||
| }); | ||
|
|
||
| req.on('error', (e) => { | ||
| console.error(e); | ||
| }); | ||
|
|
||
| req.end(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| #!/bin/bash | ||
| rimraf ./lib-es5 | ||
| babel lib --out-dir lib-es5 --verbose |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #!/bin/bash | ||
| dtslint --expectOnly --localTs node_modules/typescript/lib types |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #!/bin/bash | ||
| npm run compile && jsdoc -d docs -r -p lib/* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #!/bin/bash | ||
| mocha -R spec --recursive --require 'babel-register' --require 'babel-polyfill' test/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| #!/bin/bash | ||
| COLLECT_COVERAGE=0; | ||
|
|
||
| for arg in "$@" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/bash | ||
| node tools/createTestCloud && source tools/cloudinary_url.sh && npm run test |
Uh oh!
There was an error while loading. Please reload this page.