-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathextension.test.ts
More file actions
76 lines (63 loc) · 2.11 KB
/
extension.test.ts
File metadata and controls
76 lines (63 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { join } from 'path';
import { env } from 'process';
import { App, Stack } from 'aws-cdk-lib';
import { Template } from 'aws-cdk-lib/assertions';
import { Architecture } from 'aws-cdk-lib/aws-lambda';
import { RustExtension, cargoLambdaVersion } from '../src/index';
const forcedDockerBundling = !!env.FORCE_DOCKER_RUN || !cargoLambdaVersion();
describe('CargoLambda.RustExtension', () => {
describe('With single package Cargo project', () => {
const app = new App();
const stack = new Stack(app);
const testSource = join(__dirname, 'fixtures/single-package');
new RustExtension(stack, 'rust extension', {
manifestPath: testSource,
bundling: {
forcedDockerBundling,
},
});
test('bundle extension', () => {
app.synth();
});
});
describe('With a Cargo workspace', () => {
const app = new App();
const stack = new Stack(app);
const testSource = join(__dirname, 'fixtures/cargo-workspace');
new RustExtension(stack, 'rust extension 1', {
manifestPath: join(testSource, 'binary1'),
binaryName: 'binary1',
bundling: {
forcedDockerBundling,
},
});
new RustExtension(stack, 'rust extension 2', {
manifestPath: join(testSource, 'binary2'),
binaryName: 'binary2',
bundling: {
forcedDockerBundling,
},
});
test('bundle extension', () => {
app.synth();
});
});
describe('With ARM64 architecture', () => {
const app = new App();
const stack = new Stack(app);
const testSource = join(__dirname, 'fixtures/single-package');
new RustExtension(stack, 'rust extension arm64', {
manifestPath: testSource,
architecture: Architecture.ARM_64,
});
test('bundle extension with ARM64 architecture', () => {
// Synthesize the stack to a CloudFormation template
const template = Template.fromStack(stack);
// Verify that the Lambda layer has ARM64 in compatibleArchitectures
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
CompatibleArchitectures: ['arm64'],
});
app.synth();
});
});
});