Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/state/utils/get-state-bucket-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ensureRemoteStateBucketStackExists = async (context, stateConfiguration) =
// TODO: REPLACE WITH PROGRESS
context.output.log('Creating S3 bucket for remote state');

const bucketName = `serverless-compose-state-${crypto.randomBytes(6).toString('hex')}`;
const bucketName = `serverless-compose-state-${crypto.randomBytes(12).toString('hex')}`;
await client.createStack({
StackName: COMPOSE_REMOTE_STATE_STACK_NAME,
TemplateBody: templateBody,
Expand Down
12 changes: 6 additions & 6 deletions test/unit/src/state/utils/get-state-bucket-name.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ describe('test/unit/src/state/utils/get-state-bucket-name.test.js', () => {
.on(DescribeStacksCommand)
.resolves({ Stacks: [{ StackStatus: 'CREATE_COMPLETE' }] });

expect(
(await getStateBucketName(configuration, context)).startsWith('serverless-compose-state-')
).to.be.true;
expect(await getStateBucketName(configuration, context)).to.match(
/^serverless-compose-state-[a-f0-9]{24}$/
);
});

it('handles SDK v3 ValidationError names when bucket stack has to be created', async () => {
Expand All @@ -92,9 +92,9 @@ describe('test/unit/src/state/utils/get-state-bucket-name.test.js', () => {
.on(DescribeStacksCommand)
.resolves({ Stacks: [{ StackStatus: 'CREATE_COMPLETE' }] });

expect(
(await getStateBucketName(configuration, context)).startsWith('serverless-compose-state-')
).to.be.true;
expect(await getStateBucketName(configuration, context)).to.match(
/^serverless-compose-state-[a-f0-9]{24}$/
);
});

it('handles unexpected error when resolving bucket from s3', async () => {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/src/utils/spawn.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const fs = require('fs').promises;
const crypto = require('crypto');
const path = require('path');
const { EventEmitter } = require('events');
const nodeStream = require('stream');
Expand Down Expand Up @@ -74,7 +75,7 @@ const assertRedaction = async ({ args, redacted, visible = [] }) => {
describe('spawn', () => {
it('executes PATH shims through cross-platform resolution', async () => {
const tempDir = await fs.mkdtemp(path.join(process.cwd(), 'spawn-shim-'));
const commandName = `spawn-shim-${process.pid}-${Date.now()}`;
const commandName = `spawn-shim-${crypto.randomBytes(12).toString('hex')}`;
const commandPath = path.join(
tempDir,
process.platform === 'win32' ? `${commandName}.cmd` : commandName
Expand Down
Loading