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

fix: allow ps:scale to handle extra args #2643

Merged
merged 1 commit into from Feb 16, 2024
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
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