Skip to content
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

remove shield from isPrivate() #204

Merged
merged 6 commits into from Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions commands/zookeeper.js
Expand Up @@ -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

Expand All @@ -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')
}

Expand Down
6 changes: 3 additions & 3 deletions lib/shared.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -146,6 +146,6 @@ module.exports = {
deprecated,
parseBool,
parseDuration,
isPrivate,
isZookeeperAllowed,
formatIntervalFromMilliseconds
}
4 changes: 2 additions & 2 deletions test/commands/zookeeper_test.js
Expand Up @@ -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()
Expand All @@ -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'))
Expand Down
18 changes: 9 additions & 9 deletions test/lib/shared_test.js
Expand Up @@ -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 ],
Expand All @@ -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)
})
})
Expand Down