@@ -19,6 +19,7 @@ import software.aws.toolkits.core.utils.RuleUtils
19
19
import software.aws.toolkits.jetbrains.core.credentials.MockCredentialsManager
20
20
import software.aws.toolkits.jetbrains.services.lambda.execution.local.createHandlerBasedRunConfiguration
21
21
import software.aws.toolkits.jetbrains.services.lambda.execution.local.createTemplateRunConfiguration
22
+ import software.aws.toolkits.jetbrains.services.lambda.sam.SamOptions
22
23
import software.aws.toolkits.jetbrains.utils.addBreakpoint
23
24
import software.aws.toolkits.jetbrains.utils.checkBreakPointHit
24
25
import software.aws.toolkits.jetbrains.utils.executeRunConfigurationAndWait
@@ -97,13 +98,17 @@ class JavaLocalLambdaRunConfigurationIntegrationTest(private val runtime: Lambda
97
98
MockCredentialsManager .getInstance().reset()
98
99
}
99
100
101
+ /* Building in a container ensures consistency with the AWS Lambda runtime, reducing errors
102
+ and providing isolated environments to avoid conflicts with local dependencies or configurations */
103
+
100
104
@Test
101
105
fun samIsExecuted () {
102
106
val runConfiguration = createHandlerBasedRunConfiguration(
103
107
project = projectRule.project,
104
108
runtime = runtime.toSdkRuntime(),
105
109
input = " \" Hello World\" " ,
106
- credentialsProviderId = mockId
110
+ credentialsProviderId = mockId,
111
+ samOptions = SamOptions (buildInContainer = true )
107
112
)
108
113
assertThat(runConfiguration).isNotNull
109
114
@@ -120,7 +125,8 @@ class JavaLocalLambdaRunConfigurationIntegrationTest(private val runtime: Lambda
120
125
runtime = runtime.toSdkRuntime(),
121
126
input = projectRule.fixture.tempDirFixture.createFile(" tmp" , " \" Hello World\" " ).canonicalPath!! ,
122
127
inputIsFile = true ,
123
- credentialsProviderId = mockId
128
+ credentialsProviderId = mockId,
129
+ samOptions = SamOptions (buildInContainer = true )
124
130
)
125
131
assertThat(runConfiguration).isNotNull
126
132
@@ -152,7 +158,8 @@ class JavaLocalLambdaRunConfigurationIntegrationTest(private val runtime: Lambda
152
158
templateFile = templateFile.containingFile.virtualFile.path,
153
159
logicalId = " SomeFunction" ,
154
160
input = " \" Hello World\" " ,
155
- credentialsProviderId = mockId
161
+ credentialsProviderId = mockId,
162
+ samOptions = SamOptions (buildInContainer = true )
156
163
)
157
164
158
165
assertThat(runConfiguration).isNotNull
@@ -185,7 +192,8 @@ class JavaLocalLambdaRunConfigurationIntegrationTest(private val runtime: Lambda
185
192
templateFile = templateFile.containingFile.virtualFile.path,
186
193
logicalId = " SomeFunction" ,
187
194
input = " \" Hello World\" " ,
188
- credentialsProviderId = mockId
195
+ credentialsProviderId = mockId,
196
+ samOptions = SamOptions (buildInContainer = true )
189
197
)
190
198
191
199
assertThat(runConfiguration).isNotNull
@@ -204,7 +212,8 @@ class JavaLocalLambdaRunConfigurationIntegrationTest(private val runtime: Lambda
204
212
project = projectRule.project,
205
213
runtime = runtime.toSdkRuntime(),
206
214
input = " \" Hello World\" " ,
207
- credentialsProviderId = mockId
215
+ credentialsProviderId = mockId,
216
+ samOptions = SamOptions (buildInContainer = true )
208
217
)
209
218
assertThat(runConfiguration).isNotNull
210
219
0 commit comments