Skip to content

Commit

Permalink
Merge branch 'master' into jackdanger/allow-specific-apigateway-logs-…
Browse files Browse the repository at this point in the history
…role
  • Loading branch information
pmuens committed Oct 23, 2019
2 parents 68c46b4 + 46aa304 commit 25bb4e2
Show file tree
Hide file tree
Showing 30 changed files with 782 additions and 407 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# 1.55.0 (2019-10-23)

- [Allow empty arrays in overrides](https://github.com/serverless/serverless/pull/6813)
- [Make question mark available as variables fallback](https://github.com/serverless/serverless/pull/6808)
- [Improve plugins resolution and initialization flow](https://github.com/serverless/serverless/pull/6814)
- [Azure Python template](https://github.com/serverless/serverless/pull/6822)
- [Chore - stop using deprecated 'new Buffer()' method.](https://github.com/serverless/serverless/pull/6829)
- [AWS - adding naming function for S3 compiled template file name.](https://github.com/serverless/serverless/pull/6828)
- [Span docs! and full `serverless_sdk` docs](https://github.com/serverless/serverless/pull/6809)
- [Fix perms with several CloudWatch log subscriptions](https://github.com/serverless/serverless/pull/6827)
- [Fixing an Azure docs broken link](https://github.com/serverless/serverless/pull/6838)
- [Adding note to Azure nodejs template](https://github.com/serverless/serverless/pull/6839)
- [Updated Azure Functions documentation](https://github.com/serverless/serverless/pull/6840)
- [Support for NotAction and NotResource in IAM role statements](https://github.com/serverless/serverless/pull/6842)
- [added frontmatter to sdk docs](https://github.com/serverless/serverless/pull/6845)
- [Setup <tab> completion via CLI command and interactive CLI step](https://github.com/serverless/serverless/pull/6835)
- [Upgrade gradle version](https://github.com/serverless/serverless/pull/6855)
- [Update Google provider documentation for functions](https://github.com/serverless/serverless/pull/6854)
- [SNS integration tests](https://github.com/serverless/serverless/pull/6846)
- [SQS integration tests](https://github.com/serverless/serverless/pull/6847)
- [Streams integration tests](https://github.com/serverless/serverless/pull/6848)
- [Improvements on SQS docs as suggested on #6516](https://github.com/serverless/serverless/pull/6853)
- [Schedule integration tests](https://github.com/serverless/serverless/pull/6851)
- [Update event documentation](https://github.com/serverless/serverless/pull/6857)
- [Upgrade groovy/gradle/plugin versions and dependencies (aws-groovy-gradle)](https://github.com/serverless/serverless/pull/6862)
- [Upgrade gradle/plugins version and dependencies (aws-clojure-gradle)](https://github.com/serverless/serverless/pull/6861)
- [IoT integration tests](https://github.com/serverless/serverless/pull/6837)
- [Update https-proxy-agent dependency](https://github.com/serverless/serverless/pull/6866)
- [Allow to use Ref in stream arn property](https://github.com/serverless/serverless/pull/6856)
- [Add Tests for resolveFilePathsFromPatterns()](https://github.com/serverless/serverless/pull/6825)
- [Integration tests improvements and fixes](https://github.com/serverless/serverless/pull/6867)
- [Honor cfnRole in custom resources](https://github.com/serverless/serverless/pull/6871)

## Meta

- [Comparison since last release](https://github.com/serverless/serverless/compare/v1.54.0...v1.55.0)

# 1.54.0 (2019-10-09)

- [Fixing typos in variable names](https://github.com/serverless/serverless/pull/6746)
Expand Down
4 changes: 4 additions & 0 deletions docs/providers/aws/events/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ functions:
type: kinesis
arn:
Fn::ImportValue: MyExportedKinesisStreamArnId
- stream:
type: dynamodb
arn:
Ref: MyDynamoDbTableStreamArn
- stream:
type: kinesis
arn:
Expand Down
70 changes: 17 additions & 53 deletions lib/classes/CLI.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
'use strict';

/* eslint-disable no-unused-expressions */

const chai = require('chai');
const sinon = require('sinon');
const CLI = require('../../lib/classes/CLI');
const os = require('os');
const fse = require('fs-extra');
const exec = require('child_process').exec;
const path = require('path');
const spawn = require('child-process-ext/spawn');
const resolveAwsEnv = require('@serverless/test/resolve-env');
const stripAnsi = require('strip-ansi');
const Serverless = require('../../lib/Serverless');
const { getTmpDirPath } = require('../../tests/utils/fs');
Expand Down Expand Up @@ -624,8 +621,10 @@ describe('CLI', () => {
});

describe('Integration tests', function() {
this.timeout(0);
this.timeout(1000 * 60 * 10);
const that = this;
const serverlessExec = require('../../tests/serverless-binary');
const env = resolveAwsEnv();

before(() => {
const tmpDir = getTmpDirPath();
Expand All @@ -634,62 +633,27 @@ describe('CLI', () => {

fse.mkdirsSync(tmpDir);
process.chdir(tmpDir);

serverless = new Serverless();
return serverless.init().then(() => {
// Cannot rely on shebang in severless.js to invoke script using NodeJS on Windows.
const execPrefix = os.platform() === 'win32' ? 'node ' : '';

that.serverlessExec =
execPrefix + path.join(serverless.config.serverlessPath, '..', 'bin', 'serverless');
});
});

after(() => {
process.chdir(that.cwd);
});

it('should print general --help to stdout', done => {
exec(`${this.serverlessExec} --help`, (err, stdout, stderr) => {
if (err) {
process.stdout.write(stdout);
process.stderr.write(stderr);
done(err);
return;
}

expect(stdout).to.contain('contextual help');
done();
});
});

it('should print command --help to stdout', done => {
exec(`${this.serverlessExec} deploy --help`, (err, stdout, stderr) => {
if (err) {
process.stdout.write(stdout);
process.stderr.write(stderr);
done(err);
return;
}
it('should print general --help to stdout', () =>
spawn(serverlessExec, ['--help'], { env }).then(({ stdoutBuffer }) =>
expect(String(stdoutBuffer)).to.contain('contextual help')
));

it('should print command --help to stdout', () =>
spawn(serverlessExec, ['deploy', '--help'], { env }).then(({ stdoutBuffer }) => {
const stdout = String(stdoutBuffer);
expect(stdout).to.contain('deploy');
expect(stdout).to.contain('--stage');
done();
});
});
}));

it('should print help --verbose to stdout', done => {
exec(`${this.serverlessExec} help --verbose`, (err, stdout, stderr) => {
if (err) {
process.stdout.write(stdout);
process.stderr.write(stderr);
done(err);
return;
}

expect(stdout).to.contain('Commands by plugin');
done();
});
});
it('should print help --verbose to stdout', () =>
spawn(serverlessExec, ['help', '--verbose'], { env }).then(({ stdoutBuffer }) =>
expect(String(stdoutBuffer)).to.contain('Commands by plugin')
));
});
});
47 changes: 15 additions & 32 deletions lib/classes/PluginManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
const chai = require('chai');
const overrideEnv = require('process-utils/override-env');
const cjsResolve = require('ncjsm/resolve/sync');
const spawn = require('child-process-ext/spawn');
const resolveAwsEnv = require('@serverless/test/resolve-env');
const Serverless = require('../../lib/Serverless');
const CLI = require('../../lib/classes/CLI');
const Create = require('../../lib/plugins/create/create');
Expand All @@ -14,12 +16,10 @@ const path = require('path');
const fs = require('fs');
const fse = require('fs-extra');
const mockRequire = require('mock-require');
const os = require('os');
const sinon = require('sinon');
const proxyquire = require('proxyquire');
const BbPromise = require('bluebird');
const getCacheFilePath = require('../utils/getCacheFilePath');
const { execSync } = require('child_process');
const { installPlugin } = require('../../tests/utils/plugins');
const { getTmpDirPath } = require('../../tests/utils/fs');

Expand All @@ -29,6 +29,7 @@ chai.use(require('sinon-chai'));
const expect = chai.expect;

describe('PluginManager', () => {
const env = resolveAwsEnv();
let pluginManager;
let serverless;

Expand Down Expand Up @@ -2005,35 +2006,25 @@ describe('PluginManager', () => {
});

describe('Plugin / CLI integration', function() {
this.timeout(0);
this.timeout(1000 * 60 * 10);

const cwd = process.cwd();
let serverlessInstance;
let serviceDir;
let serverlessExec;
const serverlessExec = require('../../tests/serverless-binary');

beforeEach(() => {
// eslint-disable-line prefer-arrow-callback
serverlessInstance = new Serverless();
return serverlessInstance.init().then(() => {
// Cannot rely on shebang in severless.js to invoke script using NodeJS on Windows.
const execPrefix = os.platform() === 'win32' ? 'node ' : '';
serverlessExec =
execPrefix +
path.join(serverlessInstance.config.serverlessPath, '..', 'bin', 'serverless');
const tmpDir = getTmpDirPath();
serviceDir = path.join(tmpDir, 'service');
fse.mkdirsSync(serviceDir);
process.chdir(serviceDir);

try {
execSync(`${serverlessExec} create --template aws-nodejs`);
} catch (error) {
// Expose process output in case of crash
process.stdout.write(error.stdout);
process.stderr.write(error.stderr);
throw error;
}

return spawn(serverlessExec, ['create', '--template', 'aws-nodejs'], {
env,
cwd: serviceDir,
});
});
});

Expand All @@ -2057,22 +2048,14 @@ describe('PluginManager', () => {
'plugins:\n - local-plugin\n - parent-plugin'
);

let output;
try {
output = execSync(serverlessExec);
} catch (error) {
process.stdout.write(error.stdout);
process.stdout.write(error.stderr);
throw error;
}
const stringifiedOutput = Buffer.from(output, 'base64').toString();
expect(stringifiedOutput).to.contain('SynchronousPluginMock');
expect(stringifiedOutput).to.contain('PromisePluginMock');
return spawn(serverlessExec, [], { env, cwd: serviceDir }).then(({ stdoutBuffer }) => {
const stringifiedOutput = String(stdoutBuffer);
expect(stringifiedOutput).to.contain('SynchronousPluginMock');
expect(stringifiedOutput).to.contain('PromisePluginMock');
});
});

afterEach(() => {
// eslint-disable-line prefer-arrow-callback
process.chdir(cwd);
try {
fse.removeSync(serviceDir);
} catch (e) {
Expand Down
Loading

0 comments on commit 25bb4e2

Please sign in to comment.