@@ -255,7 +255,25 @@ func TestLogProcessor(t *testing.T) {
255
255
},
256
256
},
257
257
},
258
- wantErr : fmt .Errorf ("could not create client tls credentials: %w" , errors .New ("credentials: failed to append certificates" )),
258
+ wantErr : fmt .Errorf ("could not create certificate authority chain from certificate" ),
259
+ },
260
+ {
261
+ name : "batch/otlp-grpc-bad-client-certificate" ,
262
+ processor : LogRecordProcessor {
263
+ Batch : & BatchLogRecordProcessor {
264
+ Exporter : LogRecordExporter {
265
+ OTLP : & OTLP {
266
+ Protocol : ptr ("grpc" ),
267
+ Endpoint : ptr ("localhost:4317" ),
268
+ Compression : ptr ("gzip" ),
269
+ Timeout : ptr (1000 ),
270
+ ClientCertificate : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
271
+ ClientKey : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
272
+ },
273
+ },
274
+ },
275
+ },
276
+ wantErr : fmt .Errorf ("could not use client certificate: %w" , errors .New ("tls: failed to find any PEM data in certificate input" )),
259
277
},
260
278
{
261
279
name : "batch/otlp-grpc-exporter-no-scheme" ,
@@ -350,41 +368,52 @@ func TestLogProcessor(t *testing.T) {
350
368
wantProcessor : sdklog .NewBatchProcessor (otlpHTTPExporter ),
351
369
},
352
370
{
353
- name : "batch/otlp-http-good-ca-certificate " ,
371
+ name : "batch/otlp-http-exporter-with-path " ,
354
372
processor : LogRecordProcessor {
355
373
Batch : & BatchLogRecordProcessor {
374
+ MaxExportBatchSize : ptr (0 ),
375
+ ExportTimeout : ptr (0 ),
376
+ MaxQueueSize : ptr (0 ),
377
+ ScheduleDelay : ptr (0 ),
356
378
Exporter : LogRecordExporter {
357
379
OTLP : & OTLP {
358
380
Protocol : ptr ("http/protobuf" ),
359
- Endpoint : ptr ("localhost:4317 " ),
360
- Compression : ptr ("gzip " ),
381
+ Endpoint : ptr ("http:// localhost:4318/path/123 " ),
382
+ Compression : ptr ("none " ),
361
383
Timeout : ptr (1000 ),
362
- Certificate : ptr (filepath .Join ("testdata" , "ca.crt" )),
384
+ Headers : []NameStringValuePair {
385
+ {Name : "test" , Value : ptr ("test1" )},
386
+ },
363
387
},
364
388
},
365
389
},
366
390
},
367
391
wantProcessor : sdklog .NewBatchProcessor (otlpHTTPExporter ),
368
392
},
369
393
{
370
- name : "batch/otlp-http-bad-ca-certificate " ,
394
+ name : "batch/otlp-http-exporter-no-endpoint " ,
371
395
processor : LogRecordProcessor {
372
396
Batch : & BatchLogRecordProcessor {
397
+ MaxExportBatchSize : ptr (0 ),
398
+ ExportTimeout : ptr (0 ),
399
+ MaxQueueSize : ptr (0 ),
400
+ ScheduleDelay : ptr (0 ),
373
401
Exporter : LogRecordExporter {
374
402
OTLP : & OTLP {
375
403
Protocol : ptr ("http/protobuf" ),
376
- Endpoint : ptr ("localhost:4317" ),
377
404
Compression : ptr ("gzip" ),
378
405
Timeout : ptr (1000 ),
379
- Certificate : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
406
+ Headers : []NameStringValuePair {
407
+ {Name : "test" , Value : ptr ("test1" )},
408
+ },
380
409
},
381
410
},
382
411
},
383
412
},
384
- wantErr : fmt . Errorf ( "could not create client tls credentials: %w" , errors . New ( "failed to append certificate to the cert pool" ) ),
413
+ wantProcessor : sdklog . NewBatchProcessor ( otlpHTTPExporter ),
385
414
},
386
415
{
387
- name : "batch/otlp-http-exporter-with-path " ,
416
+ name : "batch/otlp-http-exporter-no-scheme " ,
388
417
processor : LogRecordProcessor {
389
418
Batch : & BatchLogRecordProcessor {
390
419
MaxExportBatchSize : ptr (0 ),
@@ -394,8 +423,8 @@ func TestLogProcessor(t *testing.T) {
394
423
Exporter : LogRecordExporter {
395
424
OTLP : & OTLP {
396
425
Protocol : ptr ("http/protobuf" ),
397
- Endpoint : ptr ("http:// localhost:4318/path/123 " ),
398
- Compression : ptr ("none " ),
426
+ Endpoint : ptr ("localhost:4318" ),
427
+ Compression : ptr ("gzip " ),
399
428
Timeout : ptr (1000 ),
400
429
Headers : []NameStringValuePair {
401
430
{Name : "test" , Value : ptr ("test1" )},
@@ -407,49 +436,56 @@ func TestLogProcessor(t *testing.T) {
407
436
wantProcessor : sdklog .NewBatchProcessor (otlpHTTPExporter ),
408
437
},
409
438
{
410
- name : "batch/otlp-http-exporter-no-endpoint " ,
439
+ name : "batch/otlp-http-good-ca-certificate " ,
411
440
processor : LogRecordProcessor {
412
441
Batch : & BatchLogRecordProcessor {
413
- MaxExportBatchSize : ptr (0 ),
414
- ExportTimeout : ptr (0 ),
415
- MaxQueueSize : ptr (0 ),
416
- ScheduleDelay : ptr (0 ),
417
442
Exporter : LogRecordExporter {
418
443
OTLP : & OTLP {
419
444
Protocol : ptr ("http/protobuf" ),
445
+ Endpoint : ptr ("localhost:4317" ),
420
446
Compression : ptr ("gzip" ),
421
447
Timeout : ptr (1000 ),
422
- Headers : []NameStringValuePair {
423
- {Name : "test" , Value : ptr ("test1" )},
424
- },
448
+ Certificate : ptr (filepath .Join ("testdata" , "ca.crt" )),
425
449
},
426
450
},
427
451
},
428
452
},
429
453
wantProcessor : sdklog .NewBatchProcessor (otlpHTTPExporter ),
430
454
},
431
455
{
432
- name : "batch/otlp-http-exporter-no-scheme " ,
456
+ name : "batch/otlp-http-bad-ca-certificate " ,
433
457
processor : LogRecordProcessor {
434
458
Batch : & BatchLogRecordProcessor {
435
- MaxExportBatchSize : ptr (0 ),
436
- ExportTimeout : ptr (0 ),
437
- MaxQueueSize : ptr (0 ),
438
- ScheduleDelay : ptr (0 ),
439
459
Exporter : LogRecordExporter {
440
460
OTLP : & OTLP {
441
461
Protocol : ptr ("http/protobuf" ),
442
- Endpoint : ptr ("localhost:4318 " ),
462
+ Endpoint : ptr ("localhost:4317 " ),
443
463
Compression : ptr ("gzip" ),
444
464
Timeout : ptr (1000 ),
445
- Headers : []NameStringValuePair {
446
- {Name : "test" , Value : ptr ("test1" )},
447
- },
465
+ Certificate : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
448
466
},
449
467
},
450
468
},
451
469
},
452
- wantProcessor : sdklog .NewBatchProcessor (otlpHTTPExporter ),
470
+ wantErr : fmt .Errorf ("could not create certificate authority chain from certificate" ),
471
+ },
472
+ {
473
+ name : "batch/otlp-http-bad-client-certificate" ,
474
+ processor : LogRecordProcessor {
475
+ Batch : & BatchLogRecordProcessor {
476
+ Exporter : LogRecordExporter {
477
+ OTLP : & OTLP {
478
+ Protocol : ptr ("http/protobuf" ),
479
+ Endpoint : ptr ("localhost:4317" ),
480
+ Compression : ptr ("gzip" ),
481
+ Timeout : ptr (1000 ),
482
+ ClientCertificate : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
483
+ ClientKey : ptr (filepath .Join ("testdata" , "bad_cert.crt" )),
484
+ },
485
+ },
486
+ },
487
+ },
488
+ wantErr : fmt .Errorf ("could not use client certificate: %w" , errors .New ("tls: failed to find any PEM data in certificate input" )),
453
489
},
454
490
{
455
491
name : "batch/otlp-http-invalid-protocol" ,
0 commit comments