You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t.equal(given.messages.errors[0],'Agent ID is too long (max 24 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.false(given.enable,'maxlength application Name error')
126
-
119
+
t.equal(given.messages.errors[0],'Application Name is too long (max 24 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.equal(given.messages.errors[0],'Agent ID has invalid characters; allowed [a-zA-Z0-9._-]. Value: ~. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.equal(given.messages.errors[0],'Application Name has invalid characters; allowed [a-zA-Z0-9._-]. Value: ~. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.equal(given.applicationName,'appicationnameappication','application name is appicationnameappication')
157
144
t.equal(given.agentId.length,16,'random generated agent ID length is 16')
158
-
159
145
deleteprocess.env.PINPOINT_AGENT_ID
160
146
deleteprocess.env.PINPOINT_AGENT_NAME
161
147
deleteprocess.env.PINPOINT_APPLICATION_NAME
162
148
163
-
clear()
164
-
given=getConfig()
149
+
given=newConfigBuilder().build()
165
150
t.false(given.enable,'Application Name must be set')
166
151
t.true(given.agentId.length===16,'Agent ID was generated randomly')
167
152
t.false(given.agentName,'Agent Name is optional value and only set from developer')
168
153
t.equal(given.applicationName,undefined,'Application Name is required and only set from developer')
169
-
154
+
t.equal(given.messages.errors[0],'Application Name is required. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.false(given.enable,'Application Name must be set')
179
163
t.true(given.agentId.length===16,'Agent ID was generated randomly')
180
164
t.equal(given.agentName,'agent name','Agent Name is optional value and only set from developer')
181
165
t.equal(given.applicationName,'appicationnameappication','Application Name is required and only set from developer')
182
-
166
+
t.equal(given.messages.errors[0],'Agent Name has invalid characters; allowed [a-zA-Z0-9._-]. Value: agent name. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.false(given.enable,'Application Name must be set')
192
175
t.true(given.agentId.length===16,'Agent ID was generated randomly')
193
176
t.equal(given.agentName,'agent?name','Agent Name is optional value and only set from developer')
194
177
t.equal(given.applicationName,'appicationnameappication','Application Name is required and only set from developer')
195
-
178
+
t.equal(given.messages.errors[0],'Agent Name has invalid characters; allowed [a-zA-Z0-9._-]. Value: agent?name. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.false(given.enable,'Application Name must be set')
205
187
t.true(given.agentId.length===16,'Agent ID was generated randomly')
206
188
t.equal(given.agentName,'agentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagen','Agent Name is optional value and only set from developer')
207
189
t.equal(given.applicationName,'appicationnameappication','Application Name is required and only set from developer')
208
-
190
+
t.equal(given.messages.errors[0],'Agent Name is too long (max 255 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
t.true(given.enable,'Application Name must be set')
218
199
t.true(given.agentId.length===16,'Agent ID was generated randomly')
219
200
t.equal(given.agentName,'agentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameagentnameage','Agent Name is optional value and only set from developer')
220
201
t.equal(given.applicationName,'appicationnameappication','Application Name is required and only set from developer')
t.false(given.enable,'agent name over 255 disables agent')
221
+
t.equal(given.messages.errors[0],'Agent Name is too long (max 255 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
222
+
223
+
// invalid characters
224
+
process.env.PINPOINT_AGENT_NAME='agent?name'
225
+
given=newConfigBuilder().build()
226
+
t.false(given.enable,'agent name with invalid chars disables agent')
227
+
t.equal(given.messages.errors[0],'Agent Name has invalid characters; allowed [a-zA-Z0-9._-]. Value: agent?name. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
228
+
229
+
// empty allowed (optional)
230
+
process.env.PINPOINT_AGENT_NAME=''
231
+
given=newConfigBuilder().build()
232
+
t.true(given.enable,'empty agent name is allowed')
233
+
t.equal(given.agentName,undefined,'empty agent name not set')
221
234
222
235
deleteprocess.env.PINPOINT_AGENT_ID
236
+
deleteprocess.env.PINPOINT_APPLICATION_NAME
223
237
deleteprocess.env.PINPOINT_AGENT_NAME
238
+
})
239
+
240
+
test('Agent ID and Application Name multiple errors',(t)=>{
241
+
process.env.PINPOINT_AGENT_ID='agentIdagentIdagentIdageE'// 25 chars -> too long
t.equal(given.messages.errors[0],'Agent ID is too long (max 24 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
248
+
t.equal(given.messages.errors[1],'Application Name is too long (max 24 characters). See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
249
+
t.equal(given.messages.errors[2],'Application Name has invalid characters; allowed [a-zA-Z0-9._-]. Value: appicationnameappication?. See https://github.com/pinpoint-apm/pinpoint-node-agent?tab=readme-ov-file#3-configuration-with-environment-variables')
0 commit comments