@@ -10,7 +10,6 @@ import (
10
10
11
11
"github.com/stretchr/testify/require"
12
12
"go.opentelemetry.io/collector/component/componenttest"
13
- "go.opentelemetry.io/collector/featuregate"
14
13
15
14
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/entry"
16
15
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator"
@@ -631,103 +630,3 @@ func TestCRIRecombineProcessWithFailedDownstreamOperator(t *testing.T) {
631
630
})
632
631
}
633
632
}
634
-
635
- func TestProcessWithTimeRemovalFlagDisabled (t * testing.T ) {
636
- require .NoError (t , featuregate .GlobalRegistry ().Set (removeOriginalTimeField .ID (), false ))
637
- t .Cleanup (func () {
638
- require .NoError (t , featuregate .GlobalRegistry ().Set (removeOriginalTimeField .ID (), true ))
639
- })
640
-
641
- cases := []struct {
642
- name string
643
- op func () (operator.Operator , error )
644
- input * entry.Entry
645
- expect * entry.Entry
646
- }{
647
- {
648
- "docker" ,
649
- func () (operator.Operator , error ) {
650
- cfg := NewConfigWithID ("test_id" )
651
- cfg .AddMetadataFromFilePath = false
652
- cfg .Format = "docker"
653
- set := componenttest .NewNopTelemetrySettings ()
654
- return cfg .Build (set )
655
- },
656
- & entry.Entry {
657
- Body : `{"log":"INFO: log line here","stream":"stdout","time":"2029-03-30T08:31:20.545192187Z"}` ,
658
- },
659
- & entry.Entry {
660
- Attributes : map [string ]any {
661
- "time" : "2029-03-30T08:31:20.545192187Z" ,
662
- "log.iostream" : "stdout" ,
663
- },
664
- Body : "INFO: log line here" ,
665
- Timestamp : time .Date (2029 , time .March , 30 , 8 , 31 , 20 , 545192187 , time .UTC ),
666
- },
667
- },
668
- {
669
- "docker_with_auto_detection" ,
670
- func () (operator.Operator , error ) {
671
- cfg := NewConfigWithID ("test_id" )
672
- cfg .AddMetadataFromFilePath = false
673
- set := componenttest .NewNopTelemetrySettings ()
674
- return cfg .Build (set )
675
- },
676
- & entry.Entry {
677
- Body : `{"log":"INFO: log line here","stream":"stdout","time":"2029-03-30T08:31:20.545192187Z"}` ,
678
- },
679
- & entry.Entry {
680
- Attributes : map [string ]any {
681
- "time" : "2029-03-30T08:31:20.545192187Z" ,
682
- "log.iostream" : "stdout" ,
683
- },
684
- Body : "INFO: log line here" ,
685
- Timestamp : time .Date (2029 , time .March , 30 , 8 , 31 , 20 , 545192187 , time .UTC ),
686
- },
687
- },
688
- {
689
- "docker_with_auto_detection_and_metadata_from_file_path" ,
690
- func () (operator.Operator , error ) {
691
- cfg := NewConfigWithID ("test_id" )
692
- cfg .AddMetadataFromFilePath = true
693
- set := componenttest .NewNopTelemetrySettings ()
694
- return cfg .Build (set )
695
- },
696
- & entry.Entry {
697
- Body : `{"log":"INFO: log line here","stream":"stdout","time":"2029-03-30T08:31:20.545192187Z"}` ,
698
- Attributes : map [string ]any {
699
- "log.file.path" : "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log" ,
700
- },
701
- },
702
- & entry.Entry {
703
- Attributes : map [string ]any {
704
- "log.iostream" : "stdout" ,
705
- "time" : "2029-03-30T08:31:20.545192187Z" ,
706
- "log.file.path" : "/var/log/pods/some_kube-scheduler-kind-control-plane_49cc7c1fd3702c40b2686ea7486091d3/kube-scheduler44/1.log" ,
707
- },
708
- Body : "INFO: log line here" ,
709
- Resource : map [string ]any {
710
- "k8s.pod.name" : "kube-scheduler-kind-control-plane" ,
711
- "k8s.pod.uid" : "49cc7c1fd3702c40b2686ea7486091d3" ,
712
- "k8s.container.name" : "kube-scheduler44" ,
713
- "k8s.container.restart_count" : "1" ,
714
- "k8s.namespace.name" : "some" ,
715
- },
716
- Timestamp : time .Date (2029 , time .March , 30 , 8 , 31 , 20 , 545192187 , time .UTC ),
717
- },
718
- },
719
- }
720
-
721
- for _ , tc := range cases {
722
- t .Run (tc .name , func (t * testing.T ) {
723
- op , err := tc .op ()
724
- require .NoError (t , err , "did not expect operator function to return an error, this is a bug with the test case" )
725
-
726
- err = op .Process (context .Background (), tc .input )
727
- require .NoError (t , err )
728
- require .Equal (t , tc .expect , tc .input )
729
- // Stop the operator
730
- require .NoError (t , op .Stop ())
731
- })
732
- }
733
- }
0 commit comments