prometheus / node_exporter

Exporter for machine metrics
https://prometheus.io/
Apache License 2.0
11.26k stars 2.37k forks source link

end-to-end tests fail on OS X #476

Closed bs-github closed 7 years ago

bs-github commented 7 years ago

The end to end tests are executed regardless of the system the node_exporter is compiled on.

I think they are only going to succeed on Linux the way they are designed yet. I don't think that's a problem, but a simple make call should succeed on other OSes as well.

➜  node_exporter git:(master) make
>> formatting code
>> building binaries
 >   node_exporter
>> running tests
?       github.com/prometheus/node_exporter [no test files]
ok      github.com/prometheus/node_exporter/collector   0.049s
?       github.com/prometheus/node_exporter/collector/ganglia   [no test files]
>> running end-to-end tests
./end-to-end-test.sh
LOG =====================
flag provided but not defined: -collector.wifi
Usage of ./node_exporter:
  -collector.filesystem.ignored-fs-types string
        Regexp of filesystem types to ignore for filesystem collector. (default "^devfs$")
  -collector.filesystem.ignored-mount-points string
        Regexp of mount points to ignore for filesystem collector. (default "^/(dev)($|/)")
  -collector.megacli.command string
        Command to run megacli. (default "megacli")
  -collector.netdev.ignored-devices string
        Regexp of net devices to ignore for netdev collector. (default "^$")
  -collector.ntp.protocol-version int
        NTP protocol version (default 4)
  -collector.ntp.server string
        NTP server to use for ntp collector.
  -collector.procfs string
        procfs mountpoint. (default "/proc")
  -collector.runit.servicedir string
        Path to runit service directory. (default "/etc/service")
  -collector.supervisord.url string
        XML RPC endpoint (default "http://localhost:9001/RPC2")
  -collector.sysfs string
        sysfs mountpoint. (default "/sys")
  -collector.textfile.directory string
        Directory to read text files with metrics from.
  -collectors.enabled string
        Comma-separated list of collectors to use. (default "cpu,filesystem,loadavg,meminfo,netdev,textfile,time")
  -collectors.print
        If true, print available collectors and exit.
  -log.format value
        Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" (default "logger:stderr")
  -log.level value
        Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] (default "info")
  -version
        Print version information.
  -web.listen-address string
        Address on which to expose metrics and web interface. (default ":9100")
  -web.telemetry-path string
        Path under which to expose metrics. (default "/metrics")
=========================
./end-to-end-test.sh: line 99: kill: (87709) - No such process
make: *** [test-e2e] Error 1
grobie commented 7 years ago

What happens if you remove -collector.wifi="collector/fixtures/wifi" \ from the end-to-end-tests.sh file? Do they pass?

bs-github commented 7 years ago

removing wifi leads to

time="2017-02-28T14:50:42+01:00" level=fatal msg="Couldn't load collectors: collector 'conntrack' not available" source="node_exporter.go:153"

removing conntrack leads to

time="2017-02-28T14:52:25+01:00" level=fatal msg="Couldn't load collectors: collector 'diskstats' not available" source="node_exporter.go:153"

removing diskstats leads to

time="2017-02-28T14:54:51+01:00" level=fatal msg="Couldn't load collectors: collector 'drbd' not available" source="node_exporter.go:153"

removing drbd leads to

time="2017-02-28T14:56:06+01:00" level=fatal msg="Couldn't load collectors: collector 'edac' not available" source="node_exporter.go:153"

removing edac leads to

time="2017-02-28T14:57:20+01:00" level=fatal msg="Couldn't load collectors: collector 'entropy' not available" source="node_exporter.go:153"

removing entropy leads to

time="2017-02-28T14:58:57+01:00" level=fatal msg="Couldn't load collectors: collector 'filefd' not available" source="node_exporter.go:153"

removing filefd leads to

time="2017-02-28T15:01:16+01:00" level=fatal msg="Couldn't load collectors: collector 'hwmon' not available" source="node_exporter.go:153"

removing hwmon leads to

time="2017-02-28T15:01:52+01:00" level=fatal msg="Couldn't load collectors: collector 'infiniband' not available" source="node_exporter.go:153"

and so it goes on...

do you think we should disable every single collector for the end to end test?

This is what works out of the box:

INFO[0000] Enabled collectors:                           source="node_exporter.go:156"
INFO[0000]  - cpu                                        source="node_exporter.go:158"
INFO[0000]  - filesystem                                 source="node_exporter.go:158"
INFO[0000]  - loadavg                                    source="node_exporter.go:158"
INFO[0000]  - meminfo                                    source="node_exporter.go:158"
INFO[0000]  - netdev                                     source="node_exporter.go:158"
INFO[0000]  - textfile                                   source="node_exporter.go:158"
INFO[0000]  - time                                       source="node_exporter.go:158"
INFO[0000] Listening on :9100                            source="node_exporter.go:176"
grobie commented 7 years ago

Well, that's not worth it I guess. We execute the end-to-end tests in CI / Travis under linux anyway, so probably not a big deal to just completely disable them on non-linux systems for now.

bs-github commented 7 years ago

And with all the not working collectors removed:

collectors=$(cat << COLLECTORS
  buddyinfo
  loadavg
  meminfo
  netdev
  textfile
  megacli
COLLECTORS
)

there comes the diff https://github.com/prometheus/node_exporter/blob/master/end-to-end-test.sh#L126-L128 that won't work with all those disabled.

grobie commented 7 years ago

We need to improve our end-to-end test framework. See #478.