@@ -22,8 +22,6 @@ import (
22
22
)
23
23
24
24
func Test_ProcessScrape (t * testing.T ) {
25
- t .Skip ("TODO: Skipping for now due to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32536" )
26
-
27
25
expectedFile := filepath .Join ("testdata" , "e2e" , "expected_process.yaml" )
28
26
cmd := exec .Command ("/bin/sleep" , "300" )
29
27
require .NoError (t , cmd .Start ())
@@ -38,6 +36,7 @@ func Test_ProcessScrape(t *testing.T) {
38
36
rCfg := cfg .(* Config )
39
37
rCfg .CollectionInterval = time .Second
40
38
pCfg := (& processscraper.Factory {}).CreateDefaultConfig ().(* processscraper.Config )
39
+ pCfg .MuteProcessExeError = true
41
40
pCfg .Include = processscraper.MatchConfig {
42
41
Config : filterset.Config {MatchType : filterset .Regexp },
43
42
Names : []string {"sleep" },
@@ -48,6 +47,9 @@ func Test_ProcessScrape(t *testing.T) {
48
47
}),
49
48
scraperinttest .WithExpectedFile (expectedFile ),
50
49
scraperinttest .WithCompareOptions (
50
+ pmetrictest .IgnoreResourceAttributeValue ("process.owner" ),
51
+ pmetrictest .IgnoreResourceAttributeValue ("process.parent_pid" ),
52
+ pmetrictest .IgnoreResourceAttributeValue ("process.pid" ),
51
53
pmetrictest .IgnoreResourceMetricsOrder (),
52
54
pmetrictest .IgnoreMetricValues (),
53
55
pmetrictest .IgnoreMetricDataPointsOrder (),
@@ -58,25 +60,22 @@ func Test_ProcessScrape(t *testing.T) {
58
60
}
59
61
60
62
func Test_ProcessScrapeWithCustomRootPath (t * testing.T ) {
61
- t .Skip ("TODO: Skipping for now due to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32536" )
62
-
63
63
expectedFile := filepath .Join ("testdata" , "e2e" , "expected_process_separate_proc.yaml" )
64
64
65
65
scraperinttest .NewIntegrationTest (
66
66
NewFactory (),
67
67
scraperinttest .WithCustomConfig (
68
68
func (_ * testing.T , cfg component.Config , _ * scraperinttest.ContainerInfo ) {
69
+ rootPath := filepath .Join ("testdata" , "e2e" )
69
70
rCfg := cfg .(* Config )
70
71
rCfg .CollectionInterval = time .Second
72
+ rCfg .RootPath = rootPath
71
73
pCfg := (& processscraper.Factory {}).CreateDefaultConfig ().(* processscraper.Config )
72
- pCfg .Include = processscraper.MatchConfig {
73
- Config : filterset.Config {MatchType : filterset .Regexp },
74
- Names : []string {"sleep" },
75
- }
74
+ pCfg .SetRootPath (rootPath )
75
+ pCfg .SetEnvMap (setGoPsutilEnvVars (rootPath , & osEnv {}))
76
76
rCfg .Scrapers = map [string ]internal.Config {
77
77
"process" : pCfg ,
78
78
}
79
- rCfg .RootPath = filepath .Join ("testdata" , "e2e" )
80
79
}),
81
80
scraperinttest .WithExpectedFile (expectedFile ),
82
81
scraperinttest .WithCompareOptions (
@@ -90,25 +89,24 @@ func Test_ProcessScrapeWithCustomRootPath(t *testing.T) {
90
89
}
91
90
92
91
func Test_ProcessScrapeWithBadRootPathAndEnvVar (t * testing.T ) {
93
- t . Skip ( "TODO: Skipping for now due to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32536 " )
94
-
92
+ rootPath := filepath . Join ( "testdata" , "e2e" , "proc " )
93
+ badRootPath := filepath . Join ( "testdata" , "NOT A VALID FOLDER" )
95
94
expectedFile := filepath .Join ("testdata" , "e2e" , "expected_process_separate_proc.yaml" )
96
- t .Setenv ("HOST_PROC" , filepath .Join ("testdata" , "e2e" , "proc" ))
95
+
96
+ t .Setenv ("HOST_PROC" , rootPath )
97
97
scraperinttest .NewIntegrationTest (
98
98
NewFactory (),
99
99
scraperinttest .WithCustomConfig (
100
100
func (_ * testing.T , cfg component.Config , _ * scraperinttest.ContainerInfo ) {
101
101
rCfg := cfg .(* Config )
102
102
rCfg .CollectionInterval = time .Second
103
103
pCfg := (& processscraper.Factory {}).CreateDefaultConfig ().(* processscraper.Config )
104
- pCfg .Include = processscraper.MatchConfig {
105
- Config : filterset.Config {MatchType : filterset .Regexp },
106
- Names : []string {"sleep" },
107
- }
104
+ pCfg .SetRootPath (badRootPath )
105
+ pCfg .SetEnvMap (setGoPsutilEnvVars (badRootPath , & osEnv {}))
108
106
rCfg .Scrapers = map [string ]internal.Config {
109
107
"process" : pCfg ,
110
108
}
111
- rCfg .RootPath = filepath . Join ( "testdata" , "NOT A VALID FOLDER" )
109
+ rCfg .RootPath = badRootPath
112
110
}),
113
111
scraperinttest .WithExpectedFile (expectedFile ),
114
112
scraperinttest .WithCompareOptions (
0 commit comments