@@ -50,12 +50,13 @@ void shouldSetLambdaContextWhenEnabled() {
50
50
requestHandler .handleRequest (new Object (), context );
51
51
52
52
assertThat (ThreadContext .getImmutableContext ())
53
- .hasSize (5 )
53
+ .hasSize (6 )
54
54
.containsEntry (DefaultLambdaFields .FUNCTION_ARN .getName (), "testArn" )
55
55
.containsEntry (DefaultLambdaFields .FUNCTION_MEMORY_SIZE .getName (), "10" )
56
56
.containsEntry (DefaultLambdaFields .FUNCTION_VERSION .getName (), "1" )
57
57
.containsEntry (DefaultLambdaFields .FUNCTION_NAME .getName (), "testFunction" )
58
- .containsKey ("coldStart" );
58
+ .containsKey ("coldStart" )
59
+ .containsKey ("service" );
59
60
}
60
61
61
62
@ Test
@@ -65,26 +66,27 @@ void shouldSetLambdaContextForStreamHandlerWhenEnabled() throws IOException {
65
66
requestStreamHandler .handleRequest (new ByteArrayInputStream (new byte []{}), new ByteArrayOutputStream (), context );
66
67
67
68
assertThat (ThreadContext .getImmutableContext ())
68
- .hasSize (5 )
69
+ .hasSize (6 )
69
70
.containsEntry (DefaultLambdaFields .FUNCTION_ARN .getName (), "testArn" )
70
71
.containsEntry (DefaultLambdaFields .FUNCTION_MEMORY_SIZE .getName (), "10" )
71
72
.containsEntry (DefaultLambdaFields .FUNCTION_VERSION .getName (), "1" )
72
73
.containsEntry (DefaultLambdaFields .FUNCTION_NAME .getName (), "testFunction" )
73
- .containsKey ("coldStart" );
74
+ .containsKey ("coldStart" )
75
+ .containsKey ("service" );
74
76
}
75
77
76
78
@ Test
77
79
void shouldSetColdStartFlag () throws IOException {
78
80
requestStreamHandler .handleRequest (new ByteArrayInputStream (new byte []{}), new ByteArrayOutputStream (), context );
79
81
80
82
assertThat (ThreadContext .getImmutableContext ())
81
- .hasSize (5 )
83
+ .hasSize (6 )
82
84
.containsEntry ("coldStart" , "true" );
83
85
84
86
requestStreamHandler .handleRequest (new ByteArrayInputStream (new byte []{}), new ByteArrayOutputStream (), context );
85
87
86
88
assertThat (ThreadContext .getImmutableContext ())
87
- .hasSize (5 )
89
+ .hasSize (6 )
88
90
.containsEntry ("coldStart" , "false" );
89
91
}
90
92
@@ -125,7 +127,7 @@ void shouldLogEventForHandler() {
125
127
requestHandler .handleRequest (new Object (), context );
126
128
127
129
assertThat (ThreadContext .getImmutableContext ())
128
- .hasSize (5 );
130
+ .hasSize (6 );
129
131
}
130
132
131
133
@ Test
@@ -142,7 +144,16 @@ void shouldLogEventForStreamAndLambdaStreamIsValid() throws IOException {
142
144
.isEqualTo ("{\" test\" :\" payload\" }" );
143
145
144
146
assertThat (ThreadContext .getImmutableContext ())
145
- .hasSize (5 );
147
+ .hasSize (6 );
148
+ }
149
+
150
+ @ Test
151
+ void shouldLogServiceNameWhenEnvVarSet () {
152
+ requestHandler .handleRequest (new Object (), context );
153
+
154
+ assertThat (ThreadContext .getImmutableContext ())
155
+ .hasSize (6 )
156
+ .containsEntry ("service" , "testService" );
146
157
}
147
158
148
159
private void setupContext () {
0 commit comments