Skip to content

Commit

Permalink
Fix bundling tests and force Docker bundling for Integration tests to…
Browse files Browse the repository at this point in the history
… guarantee same behavior between local / CI tests
  • Loading branch information
stevehouel committed Jan 31, 2024
1 parent aad2573 commit 32837fa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class Bundling implements CdkBundlingOptions {
!checkInstalledTarget(toTarget(this.props.architecture));
this.image = shouldBuildImage
? props.dockerImage ??
DockerImage.fromBuild(__dirname, {
DockerImage.fromBuild(path.join(__dirname, '../'), {
buildArgs: {
...(props.buildArgs ?? {}),
// If runtime isn't passed use regional default, lowest common denominator is node18
Expand Down
4 changes: 2 additions & 2 deletions test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Bundling in Docker', () => {
);

expect(DockerImage.fromBuild).toHaveBeenCalledWith(
expect.stringMatching(/aws-lambda-rust\/lib$/),
expect.stringMatching(/aws-lambda-rust\/$/),
expect.objectContaining({
buildArgs: expect.objectContaining({
IMAGE: expect.stringMatching(/build-provided.al2023$/),
Expand Down Expand Up @@ -274,7 +274,7 @@ describe('Bundling in Docker', () => {
});

expect(DockerImage.fromBuild).toHaveBeenCalledWith(
expect.stringMatching(/lib$/),
expect.stringMatching(/aws-lambda-rust\/$/),
expect.objectContaining({
buildArgs: expect.objectContaining({
HELLO: 'WORLD',
Expand Down
3 changes: 3 additions & 0 deletions test/integ.function-bins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class TestStack extends Stack {
const fn = new RustFunction(this, 'binary1', {
entry: 'rust-bins/Cargo.toml',
binaryName: 'my_lambda1',
bundling: {
forceDockerBundling: true,
},
});
this.functionName = fn.functionName;

Expand Down
3 changes: 3 additions & 0 deletions test/integ.function-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class TestStack extends Stack {
const fn = new RustFunction(this, 'binary1', {
entry: 'rust-workspaces/Cargo.toml',
binaryName: 'my_lambda2',
bundling: {
forceDockerBundling: true,
},
});
this.functionName = fn.functionName;

Expand Down
3 changes: 3 additions & 0 deletions test/integ.function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class TestStack extends Stack {

const fn = new RustFunction(this, 'binary1', {
entry: 'rust-standalone/Cargo.toml',
bundling: {
forceDockerBundling: true,
},
});
this.functionName = fn.functionName;

Expand Down

0 comments on commit 32837fa

Please sign in to comment.