Packetbeat: Code Coverage for your Golang System Tests

I followed this blog and want to do Code Coverage System test.But I can't find the param in the blog.

$ ./packetbeat.test -h
Usage of ./packetbeat.test:
  -I string
          file
  -N    Disable actual publishing for testing
    -O    Read packets one at a time (press Enter)
  -c string
        Configuration file (default "/etc/beat/beat.yml")
  -cpuprofile string
        Write cpu profile to fil
  ...

in my machine, the usage is different.
-systemTest and -c param belongs to different file. -systemTest is the usage of packetbeat.test ,-c is the usage of packetbeat.
the error is : flag provided but not defined: -c
so

packetbeat.test -systemTest -c config.yml -test.coverprofile coverage.cov

can't be exec in my machine.

Which branch are you using? In master we change a little how beats are run (introducing support for sub commands).

We normally run system tests via make. You can ask make to print the commands to be executed via make -n.

I tried Packetbeat from master and the command you specified still works despite several changes beats since that blog post.

Like you have shown with the help output, the -c flag is known to packetbeat.test so getting back flag provided but not defined: -c is odd.

This topic was automatically closed after 21 days. New replies are no longer allowed.