Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for Windows - part 1 #8414

Merged
merged 19 commits into from
Nov 23, 2020
Merged

Fix tests for Windows - part 1 #8414

merged 19 commits into from
Nov 23, 2020

Conversation

zak-pawel
Copy link
Collaborator

@zak-pawel zak-pawel commented Nov 15, 2020

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Fixing short unit tests for Windows

Based on: #6255
Should fix: #3747

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Pawel, thanks for tackling this! I've added some comments, but I have one more general one. I think you have four categories of patches here:

  1. Build-system related (makefile, appvayor, gitattributes)
  2. Actual fixes of tests
  3. Temporary deactivation of tests that really should be fixed
  4. Deactivation of tests that make no sense on Windows

Could you please reorganize them such that you have four patches, one per category? This eases bug-tracing and reviewing I think.

Furthermore, your Makefile change makes the tests on Darwin fail and I have no clue if those changes are valid. @reimda could you take a look at the changes to .gitattributes, Makefile and appveyor.yml!?

Could you please split the patches into

@srebhan srebhan self-assigned this Nov 16, 2020
Copy link
Contributor

@reimda reimda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick review of the files Sven mentioned. Looks good so far.

.gitattributes Show resolved Hide resolved
Makefile Show resolved Hide resolved
appveyor.yml Outdated Show resolved Hide resolved
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now. Thanks!

// leaving port set to zero to let kernel pick
return &net.TCPAddr{IP: naddr.IP}, nil
//need to choose IPv4 address
if len(naddr.Mask) == net.IPv4len {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change. Why do we special case IPv4 here? Is this a generic fix or specific to windows? It looks like it will break IPv6 users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are completely right. Here we have much deeper problem, I opened an issue for it: #8451. I will rollback this change in http_response.go. Till it is not fixed, I will disable http_response_test.go for Windows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Good idea separating this out

@sjwang90 sjwang90 mentioned this pull request Nov 18, 2020
1 task
Copy link
Contributor

@ssoroka ssoroka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic effort here. bravo.

@@ -1,3 +1,7 @@
// +build !windows

// TODO: should be enabled for Windows when Glob related issues for Windows are fixed
Copy link
Contributor

@ssoroka ssoroka Nov 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea what these failures are?
[edit] just curious. feel free to ignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssoroka Yes, super asterisk doesn't work for Windows, probably because there is bug in internal/globpath/globpath.go.

I put more information here: #6248 (comment)

Fixing that issue in internal/globpath/globpath.go will enable super asterisk for Windows for these plugins:

  • file
  • filecount
  • filestat
  • logparser
  • phpfpm
  • tail

go test -short $(race_detector) ./plugins/inputs/procstat/...
go test -short $(race_detector) ./plugins/inputs/ntpq/...
go test -short $(race_detector) ./plugins/processors/port_name/...
go test -short ./...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we dropped the race detector?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build with race detector temporary enabled: https://ci.appveyor.com/project/influx/telegraf/builds/36450543

go test -short -race ./...
# runtime/cgo
exec: "gcc": executable file not found in %PATH%
?   	github.com/influxdata/telegraf	[no test files]
FAIL	github.com/influxdata/telegraf/agent [build failed]
FAIL	github.com/influxdata/telegraf/config [build failed]

Probably related to golang/go#27089

Few days ago I tried with mingw installed https://ci.appveyor.com/project/influx/telegraf/builds/36325329

make test-windows
go test -short -race ./...
go build runtime/cgo: C:\go\pkg\tool\windows_amd64\cgo.exe: exit status 2
?   	github.com/influxdata/telegraf	[no test files]
FAIL	github.com/influxdata/telegraf/agent [build failed]
FAIL	github.com/influxdata/telegraf/config [build failed]

But it works fine on my local Windows.

@ssoroka if you have any idea how to configure CI for Windows to run tests with -race let me know.

config/testdata/telegraf-agent.toml Show resolved Hide resolved
@zak-pawel
Copy link
Collaborator Author

Right now there are following tests which are disabled on Windows:

  1. Tests related to super asterisk do not work on Windows (internal/globpath needs to be fixed, issue for that: FIlestat plugin and super asterisks not working on windows? #6248):

    • internal/globpath/
    • plugins/inputs/exec/
    • plugins/inputs/file/
    • plugins/inputs/filecount/
    • plugins/inputs/filestat/
    • plugins/inputs/phpfpm/
  2. Tests related to other things which do not work on Windows and need to be fixed:

  3. Tests designed only for Unix based OSes, may be adjusted also for Windows in the future:

    • internal/process/process_test.go
  4. Tests for plugins which are not aimed for Windows:

    • plugins/inputs/bcache/
    • plugins/inputs/cgroup/
    • plugins/inputs/conntrack/
    • plugins/inputs/dmcache/
    • plugins/inputs/ethtool/
    • plugins/inputs/infiniband/
    • plugins/inputs/intel_rdt/
    • plugins/inputs/iptables/
    • plugins/inputs/kernel/
    • plugins/inputs/kernel_vmstat/
    • plugins/inputs/lustre2/
    • plugins/inputs/postfix/
    • plugins/inputs/processes/
    • plugins/inputs/ras/
    • plugins/inputs/sensors/
    • plugins/inputs/synproxy/
    • plugins/inputs/sysstat/
    • plugins/inputs/varnish/
    • plugins/inputs/wireless/
    • plugins/inputs/zfs/

@ssoroka ssoroka merged commit 0fcfee0 into influxdata:master Nov 23, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test suite has multiple failure on Windows
4 participants