Skip to content

Commit

Permalink
fix: allow ps:scale to handle extra args (#2643)
Browse files Browse the repository at this point in the history
  • Loading branch information
k80bowman committed Feb 16, 2024
1 parent c02851b commit a618081
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/apps-v5/src/commands/ps/scale.js
Expand Up @@ -32,6 +32,7 @@ async function run(context, heroku) {
// eslint-disable-next-line array-callback-return
compact(args.map(arg => {
let match = arg.match(/^([\w-]+)([=+-]\d+)(?::([\w-]+))?$/)
if (match === null) return
let size = match[3]

const largerDynoNames = /^(?!standard-[12]x$)(performance|private|shield)-(l-ram|xl|2xl)$/i
Expand Down
15 changes: 15 additions & 0 deletions packages/apps-v5/test/unit/commands/ps/scale.unit.test.js
Expand Up @@ -95,6 +95,21 @@ describe('ps:scale', () => {
.then(() => api.done())
})

it('scales web=1 worker=2 when the extra arg --exit-code is added', () => {
let api = nock('https://api.heroku.com:443')
.get('/account/features/frontend-larger-dynos')
.reply(200, featureFlagPayload())
.patch('/apps/myapp/formation', {updates: [{type: 'web', quantity: '1'}, {type: 'worker', quantity: '2'}]})
.reply(200, [{type: 'web', quantity: 1, size: 'Free'}, {type: 'worker', quantity: 2, size: 'Free'}])
.get('/apps/myapp')
.reply(200, {name: 'myapp'})

return cmd.run({app: 'myapp', args: ['web=1', 'worker=2', 'exit-code']})
.then(() => expect(cli.stdout, 'to be empty'))
.then(() => expect(cli.stderr).to.equal('Scaling dynos... done, now running web at 1:Free, worker at 2:Free\n'))
.then(() => api.done())
})

it('scales up a shield dyno if the app is in a shielded private space', () => {
let api = nock('https://api.heroku.com:443')
.get('/account/features/frontend-larger-dynos')
Expand Down

0 comments on commit a618081

Please sign in to comment.