From 7aab16bb4277c4a47278aed7c71a9b69c5a4360f Mon Sep 17 00:00:00 2001 From: Justin Downing Date: Tue, 15 Sep 2020 14:59:45 -0400 Subject: [PATCH] remove shield from isPrivate() (#204) * remove shield from isPrivate() * rename * importexport * tst * missed * missed --- commands/zookeeper.js | 4 ++-- lib/shared.js | 6 +++--- test/commands/zookeeper_test.js | 4 ++-- test/lib/shared_test.js | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/commands/zookeeper.js b/commands/zookeeper.js index 773b83d..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 isPrivate = require('../lib/shared').isPrivate +let isZookeeperAllowed = require('../lib/shared').isZookeeperAllowed let withCluster = require('../lib/clusters').withCluster let request = require('../lib/clusters').request @@ -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 cbde6ed..f290269 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -40,8 +40,8 @@ function clusterConfig (attachment, config) { } } -function isPrivate (addon) { - return addon.plan.name.indexOf('private-') !== -1 || addon.plan.name.indexOf('shield-') !== -1 +function isZookeeperAllowed (addon) { + return addon.plan.name.indexOf('private-') !== -1 } function parseBool (boolStr) { @@ -146,6 +146,6 @@ module.exports = { deprecated, parseBool, parseDuration, - isPrivate, + isZookeeperAllowed, formatIntervalFromMilliseconds } 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 57d6b06..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 ], @@ -65,19 +65,19 @@ 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] 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) }) })