Skip to content

Commit

Permalink
fix(CLI Onboarding): Recognize Dashboard providers for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed May 20, 2022
1 parent 8825e86 commit 38ff287
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cli/interactive-setup/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const Serverless = require('../../serverless');
const { writeText, style, log } = require('@serverless/utils/log');
const promptWithHistory = require('@serverless/utils/inquirer/prompt-with-history');
const isDashboardEnabled = require('../../configuration/is-dashboard-enabled');
const { doesServiceInstanceHaveLinkedProvider } = require('./utils');
const _ = require('lodash');
const AWS = require('aws-sdk');
Expand Down Expand Up @@ -40,7 +39,8 @@ module.exports = {

// We want to proceed if the service instance has a linked provider
if (
isDashboardEnabled(context) &&
configuration.org &&
configuration.app &&
isAuthenticated() &&
(await doesServiceInstanceHaveLinkedProvider({ configuration, options }))
) {
Expand Down
23 changes: 23 additions & 0 deletions test/unit/lib/cli/interactive-setup/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,29 @@ describe('test/unit/lib/cli/interactive-setup/deploy.test.js', () => {
).to.equal(true);
});

it('Should be applied if service instance has a linked provider but disabled dashboard monitoring', async () => {
const mockedStep = proxyquire('../../../../../lib/cli/interactive-setup/deploy', {
'@serverless/dashboard-plugin/lib/is-authenticated': () => true,
'./utils': {
doesServiceInstanceHaveLinkedProvider: () => true,
},
});

expect(
await mockedStep.isApplicable({
configuration: {
provider: { name: 'aws' },
org: 'someorg',
app: 'someapp',
dashboard: { disableMonitoring: true },
},
serviceDir: '/foo',
options: {},
history: new Map([['awsCredentials', []]]),
})
).to.equal(true);
});

describe('run', () => {
it('should correctly handle skipping deployment for new service not configured with dashboard', async () => {
configureInquirerStub(inquirer, {
Expand Down

0 comments on commit 38ff287

Please sign in to comment.