You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by robertkowalski <gi...@git.apache.org> on 2016/10/21 15:06:37 UTC
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
GitHub user robertkowalski opened a pull request:
https://github.com/apache/couchdb-fauxton/pull/791
add script to create/delete a lot dbs
this is useful to create a lot of dbs for testing and later to
get rid of them
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/robertkowalski/couchdb-fauxton create-n-dbs
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-fauxton/pull/791.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #791
----
commit 7dbd64b4f4f6243c12d80a10ce6b6688c2d9f216
Author: Robert Kowalski <ro...@apache.org>
Date: 2016-10-21T13:02:33Z
add script to create/delete a lot dbs
this is useful to create a lot of dbs for testing and later to
get rid of them
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85748660
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
+}
+
+if (isDelete) {
+ return deleteDbs();
--- End diff --
same as above
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85753237
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
+}
+
+if (isDelete) {
+ return deleteDbs();
+}
+
+function getExistingDbs (cb) {
+ nClient.db.list((err, body) => {
+ if (err) {
+ throw err;
+ }
+
+ const list = body.filter(db => {
+ return new RegExp(NAMESPACE).test(db);
+ });
+
+ cb(null, list);
+ });
+}
+
+function createNdbs (number) {
+ getExistingDbs((err, dbs) => {
+ const offset = dbs.length;
+
+ const newDbs = [];
+ for (let i = offset; i < offset + number; i++) {
--- End diff --
ah, I see. it's for naming purposes. got it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85750557
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
+}
+
+if (isDelete) {
+ return deleteDbs();
+}
+
+function getExistingDbs (cb) {
+ nClient.db.list((err, body) => {
+ if (err) {
+ throw err;
+ }
+
+ const list = body.filter(db => {
+ return new RegExp(NAMESPACE).test(db);
+ });
+
+ cb(null, list);
+ });
+}
+
+function createNdbs (number) {
+ getExistingDbs((err, dbs) => {
+ const offset = dbs.length;
+
+ const newDbs = [];
+ for (let i = offset; i < offset + number; i++) {
+ newDbs.push(NAMESPACE + i);
+ }
+
+ const tasks = newDbs.map((db) => {
+ return function task (cb) {
+ nClient.db.create(db, (err, body) => {
+ if (err) {
+ console.error(err);
+ }
+
+ cb(null);
--- End diff --
What does this do?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85753418
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
--- End diff --
Ok, makes sense now
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85750052
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
+}
+
+if (isDelete) {
+ return deleteDbs();
+}
+
+function getExistingDbs (cb) {
+ nClient.db.list((err, body) => {
+ if (err) {
+ throw err;
+ }
+
+ const list = body.filter(db => {
+ return new RegExp(NAMESPACE).test(db);
+ });
+
+ cb(null, list);
+ });
+}
+
+function createNdbs (number) {
+ getExistingDbs((err, dbs) => {
+ const offset = dbs.length;
+
+ const newDbs = [];
+ for (let i = offset; i < offset + number; i++) {
--- End diff --
What's the purpose of the offset? Why not just iterate from 0 to the number?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85751592
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
--- End diff --
the pattern is called an early return
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85750568
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
--- End diff --
![Uploading Screen Shot 2016-10-31 at 15.36.26.png\u2026]()
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85752998
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
--- End diff --
gotcha, makes sense
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85751815
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
--- End diff --
Yes, but what about "./bin/create-n-dbs -h"?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85752119
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
--- End diff --
its part of the help message that gets displayed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski closed the pull request at:
https://github.com/apache/couchdb-fauxton/pull/791
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton issue #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on the issue:
https://github.com/apache/couchdb-fauxton/pull/791
+1
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton issue #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the issue:
https://github.com/apache/couchdb-fauxton/pull/791
merged, ty
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85751917
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
--- End diff --
http://blog.timoxley.com/post/47041269194/avoid-else-return-early
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request #791: add script to create/delete a lot dbs
Posted by millayr <gi...@git.apache.org>.
Github user millayr commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/791#discussion_r85748622
--- Diff: bin/create-n-dbs ---
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+const optimist = require('optimist');
+const nano = require('nano');
+
+const {parallelLimit} = require('async');
+
+
+const NAMESPACE = 'test-db-';
+const PARALLEL_LIMIT = 50;
+const URL = 'http://localhost:5984';
+
+optimist
+ .usage('Create a certain amount of dbs \nUsage: $0')
+
+ .options('help', {
+ alias: 'h',
+ describe: 'Show this message'
+ })
+ .options('number', {
+ alias: 'n',
+ describe: 'The amount of databases to create'
+ })
+ .options('delete', {
+ alias: 'd',
+ default: false,
+ describe: 'Delete databases'
+ });
+
+const argv = optimist.argv;
+
+if (argv.help || argv.h) {
+ return optimist.showHelp(console.log);
+}
+
+const isDelete = (argv.d || argv.delete);
+const isCreate = (argv.n || argv.number);
+
+if (!isDelete && !isCreate) {
+ console.error('[ERROR] Please provide -d or -n to delete or create test-databases \n');
+ optimist.showHelp(console.log);
+ process.exit(1);
+}
+
+const nClient = nano(URL)
+
+if (isCreate) {
+ return createNdbs(argv.n || argv.number);
--- End diff --
do you need "return" here? doesn't look like createNdbs returns anything.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton issue #791: add script to create/delete a lot dbs
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the issue:
https://github.com/apache/couchdb-fauxton/pull/791
+1 nice
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---