Skip to content

Commit ccd544b

Browse files
authored
RUST-2000 Test that both FaaS and container metadata are recorded (#1229)
1 parent e1f5889 commit ccd544b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test/spec/faas.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::env;
22

3+
use bson::rawdoc;
4+
35
use crate::{
46
cmap::establish::handshake::{
57
ClientMetadata,
@@ -192,3 +194,27 @@ async fn invalid_wrong_type() -> Result<()> {
192194
async fn invalid_aws_not_lambda() -> Result<()> {
193195
check_faas_handshake(&[("AWS_EXECUTION_ENV", "EC2")], &BASE_CLIENT_METADATA).await
194196
}
197+
198+
#[tokio::test]
199+
async fn valid_container_and_faas() -> Result<()> {
200+
check_faas_handshake(
201+
&[
202+
("AWS_EXECUTION_ENV", "AWS_Lambda_java8"),
203+
("AWS_REGION", "us-east-2"),
204+
("AWS_LAMBDA_FUNCTION_MEMORY_SIZE", "1024"),
205+
("KUBERNETES_SERVICE_HOST", "1"),
206+
],
207+
&ClientMetadata {
208+
env: Some(RuntimeEnvironment {
209+
name: Some(FaasEnvironmentName::AwsLambda),
210+
runtime: Some("AWS_Lambda_java8".to_string()),
211+
region: Some("us-east-2".to_string()),
212+
memory_mb: Some(1024),
213+
container: Some(rawdoc! { "orchestrator": "kubernetes"}),
214+
..RuntimeEnvironment::UNSET
215+
}),
216+
..BASE_CLIENT_METADATA.clone()
217+
},
218+
)
219+
.await
220+
}

0 commit comments

Comments
 (0)