From ced869474b7742cca95beee777e9d2b13d9abffd Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 13:06:30 -0400 Subject: [PATCH 1/6] remove shield from isPrivate() --- lib/shared.js | 2 +- test/lib/shared_test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/shared.js b/lib/shared.js index cbde6ed..c2d23f7 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -41,7 +41,7 @@ function clusterConfig (attachment, config) { } function isPrivate (addon) { - return addon.plan.name.indexOf('private-') !== -1 || addon.plan.name.indexOf('shield-') !== -1 + return addon.plan.name.indexOf('private-') !== -1 } function parseBool (boolStr) { diff --git a/test/lib/shared_test.js b/test/lib/shared_test.js index 57d6b06..625e51c 100644 --- a/test/lib/shared_test.js +++ b/test/lib/shared_test.js @@ -65,12 +65,12 @@ describe('isPrivate', function () { [ { plan: { name: 'private-extended-0' } }, true ], [ { plan: { name: 'private-extended-1' } }, true ], [ { plan: { name: 'private-extended-2' } }, true ], - [ { plan: { name: 'shield-standard-0' } }, true ], - [ { plan: { name: 'shield-standard-1' } }, true ], - [ { plan: { name: 'shield-standard-2' } }, true ], - [ { plan: { name: 'shield-extended-0' } }, true ], - [ { plan: { name: 'shield-extended-1' } }, true ], - [ { plan: { name: 'shield-extended-2' } }, true ] + [ { plan: { name: 'shield-standard-0' } }, false ], + [ { plan: { name: 'shield-standard-1' } }, false ], + [ { plan: { name: 'shield-standard-2' } }, false ], + [ { plan: { name: 'shield-extended-0' } }, false ], + [ { plan: { name: 'shield-extended-1' } }, false ], + [ { plan: { name: 'shield-extended-2' } }, false ] ] cases.forEach(function (testcase) { let addon = testcase[0] From 15880354d20a576ec2c6ae513f55eff225d662e1 Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:09:45 -0400 Subject: [PATCH 2/6] rename --- commands/zookeeper.js | 2 +- lib/shared.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/zookeeper.js b/commands/zookeeper.js index 773b83d..0f457ad 100644 --- a/commands/zookeeper.js +++ b/commands/zookeeper.js @@ -21,7 +21,7 @@ function * zookeeper (context, heroku) { } yield withCluster(heroku, context.app, context.args.CLUSTER, function * (addon) { - if (!isPrivate(addon)) { + if (!isZookeeperAllowed(addon)) { cli.exit(1, '`kafka:zookeeper` is only available in Heroku Private Spaces') } diff --git a/lib/shared.js b/lib/shared.js index c2d23f7..cef0b30 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -40,7 +40,7 @@ function clusterConfig (attachment, config) { } } -function isPrivate (addon) { +function isZookeeperAllowed (addon) { return addon.plan.name.indexOf('private-') !== -1 } From a7e92e9c0da10fd40e6ef9ee11200b772cb550d1 Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:34:41 -0400 Subject: [PATCH 3/6] importexport --- commands/zookeeper.js | 2 +- lib/shared.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/zookeeper.js b/commands/zookeeper.js index 0f457ad..7fd6b08 100644 --- a/commands/zookeeper.js +++ b/commands/zookeeper.js @@ -3,7 +3,7 @@ let cli = require('heroku-cli-util') let co = require('co') let parseBool = require('../lib/shared').parseBool -let isPrivate = require('../lib/shared').isPrivate +let isZookeeperAllowed = require('../lib/shared').isPrivate let withCluster = require('../lib/clusters').withCluster let request = require('../lib/clusters').request diff --git a/lib/shared.js b/lib/shared.js index cef0b30..f290269 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -146,6 +146,6 @@ module.exports = { deprecated, parseBool, parseDuration, - isPrivate, + isZookeeperAllowed, formatIntervalFromMilliseconds } From 7cae8752eb5a0a9ccc0996b6407f35b6014f609d Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:51:49 -0400 Subject: [PATCH 4/6] tst --- test/commands/zookeeper_test.js | 4 ++-- test/lib/shared_test.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/commands/zookeeper_test.js b/test/commands/zookeeper_test.js index c695d38..c963132 100644 --- a/test/commands/zookeeper_test.js +++ b/test/commands/zookeeper_test.js @@ -32,7 +32,7 @@ describe('kafka:zookeeper', () => { } beforeEach(() => { - planName = 'heroku-kafka:beta-private-standard-2' + planName = 'heroku-kafka:private-standard-2' kafka = nock('https://kafka-api.heroku.com:443') cli.mockConsole() cli.exit.mock() @@ -44,7 +44,7 @@ describe('kafka:zookeeper', () => { }) it('warns and exits with an error if used with a non-Private Spaces cluster', () => { - planName = 'heroku-kafka:beta-standard-2' + planName = 'heroku-kafka:standard-2' return expectExit(1, cmd.run({app: 'myapp', args: { VALUE: 'enable' }})) .then(() => expect(cli.stdout).to.be.empty) .then(() => expect(cli.stderr).to.equal(' ▸ `kafka:zookeeper` is only available in Heroku Private Spaces\n')) diff --git a/test/lib/shared_test.js b/test/lib/shared_test.js index 625e51c..2c7091d 100644 --- a/test/lib/shared_test.js +++ b/test/lib/shared_test.js @@ -51,7 +51,7 @@ describe('parseDuration', function () { }) }) -describe('isPrivate', function () { +describe('isZookeeperAllowed', function () { let cases = [ [ { plan: { name: 'standard-0' } }, false ], [ { plan: { name: 'standard-1' } }, false ], @@ -76,8 +76,8 @@ describe('isPrivate', function () { let addon = testcase[0] let expected = testcase[1] - it(`considers '${addon.plan.name}' to${expected ? '' : ' not'} be private'`, function () { - let actual = shared.isPrivate(addon) + it(`considers '${addon.plan.name}' to${expected ? '' : ' not'} be allowed to enable zookeeper'`, function () { + let actual = shared.isZookeeperAllowed(addon) expect(actual).to.equal(expected) }) }) From 961150621843951e34786539fec03509ea532e66 Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:54:48 -0400 Subject: [PATCH 5/6] missed --- commands/zookeeper.js | 2 +- lib/shared.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/zookeeper.js b/commands/zookeeper.js index 7fd6b08..cb7f29e 100644 --- a/commands/zookeeper.js +++ b/commands/zookeeper.js @@ -3,7 +3,7 @@ let cli = require('heroku-cli-util') let co = require('co') let parseBool = require('../lib/shared').parseBool -let isZookeeperAllowed = require('../lib/shared').isPrivate +let isZookeeperAllowed = require('../lib/shared').isZookeeperAllowed let withCluster = require('../lib/clusters').withCluster let request = require('../lib/clusters').request diff --git a/lib/shared.js b/lib/shared.js index f290269..a9692b1 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -148,4 +148,4 @@ module.exports = { parseDuration, isZookeeperAllowed, formatIntervalFromMilliseconds -} + From 82f6e71098ac535b7fabdf18a5a72dc78b06d78b Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:57:17 -0400 Subject: [PATCH 6/6] missed --- lib/shared.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared.js b/lib/shared.js index a9692b1..f290269 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -148,4 +148,4 @@ module.exports = { parseDuration, isZookeeperAllowed, formatIntervalFromMilliseconds - +}