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

Unit test on windows #2562

Merged

Conversation

prietyc123
Copy link
Contributor

@prietyc123 prietyc123 commented Feb 4, 2020

What type of PR is this?

/kind feature

What does does this PR do / why we need it:

Run all the unit test on windows platform

Which issue(s) this PR fixes:

Fixes #2539

How to test changes / Special notes to the reviewer:
Unit test should run on windows through travis CI

@openshift-ci-robot openshift-ci-robot added kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation size/S labels Feb 4, 2020
@prietyc123 prietyc123 changed the title Unit test on windows [WIP]Unit test on windows Feb 4, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Feb 4, 2020
@kanchwala-yusuf
Copy link
Contributor

@prietyc123, @amitkrout:
Have you tried running these tests locally? maybe on a windows vm? Also, would the current CI pipeline execute unit tests on windows platform?

@codecov
Copy link

codecov bot commented Feb 5, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@2cc1380). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2562   +/-   ##
=========================================
  Coverage          ?   43.64%           
=========================================
  Files             ?       82           
  Lines             ?     7511           
  Branches          ?        0           
=========================================
  Hits              ?     3278           
  Misses            ?     3912           
  Partials          ?      321
Impacted Files Coverage Δ
pkg/testingutil/survey_ui.go 0% <ø> (ø)
pkg/occlient/occlient.go 52.73% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2cc1380...0d2fc25. Read the comment docs.

@kanchwala-yusuf
Copy link
Contributor

@prietyc123 , it seems that the make command is not installed on the Travis CI machine on which the unit tests are executed. You may need to change the job config to get it installed.

@prietyc123 prietyc123 force-pushed the RunUnitTestOnWindows branch 5 times, most recently from 32c7bee to 4193876 Compare February 6, 2020 10:55
@prietyc123
Copy link
Contributor Author

/retest

1 similar comment
@amitkrout
Copy link
Contributor

/retest

@prietyc123
Copy link
Contributor Author

$ make test
go test -race github.com/openshift/odo/cmd/cli-doc github.com/openshift/odo/cmd/odo github.com/openshift/odo/pkg/application github.com/openshift/odo/pkg/application/labels github.com/openshift/odo/pkg/auth github.com/openshift/odo/pkg/catalog github.com/openshift/odo/pkg/component github.com/openshift/odo/pkg/component/labels github.com/openshift/odo/pkg/config github.com/openshift/odo/pkg/debug github.com/openshift/odo/pkg/devfile github.com/openshift/odo/pkg/devfile/parser 
[. . .]
FAIL	github.com/openshift/odo/pkg/application [build failed]
ok  	github.com/openshift/odo/pkg/application/labels	1.057s
?   	github.com/openshift/odo/pkg/auth	[no test files]
FAIL	github.com/openshift/odo/pkg/catalog [build failed]
FAIL	github.com/openshift/odo/pkg/component [build failed]
ok  	github.com/openshift/odo/pkg/component/labels	1.039s
ok  	github.com/openshift/odo/pkg/config	1.343s
?   	github.com/openshift/odo/pkg/debug	[no test files]
ok  	github.com/openshift/odo/pkg/devfile	1.111s
ok  	github.com/openshift/odo/pkg/devfile/parser	1.136s
ok  	github.com/openshift/odo/pkg/devfile/versions	1.066s
?   	github.com/openshift/odo/pkg/devfile/versions/1.0.0	[no test files]
ok  	github.com/openshift/odo/pkg/devfile/versions/common	1.146s
ok  	github.com/openshift/odo/pkg/kclient	1.201s
?   	github.com/openshift/odo/pkg/log	[no test files]
?   	github.com/openshift/odo/pkg/log/fidget	[no test files]
?   	github.com/openshift/odo/pkg/machineoutput	[no test files]
ok  	github.com/openshift/odo/pkg/notify	1.065s [no tests to run]
FAIL	github.com/openshift/odo/pkg/occlient [build failed]
[. . .]

Few unit tests build is failed. So it is blocked till #2586 issue is fixed.

@prietyc123 prietyc123 force-pushed the RunUnitTestOnWindows branch 3 times, most recently from e0cf020 to c8d0d73 Compare February 12, 2020 10:35
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Feb 13, 2020
@mik-dass
Copy link
Contributor

mik-dass commented Feb 14, 2020

Netflix/go-expect#10 according to the issue, the go-expect library is not supported on windows. We are using the library here https://github.com/openshift/odo/blob/bba04d2aeb8a4f02867b320d93554c70e7726072/glide.yaml#L46 in ODO. This is the reason build is failing on windows

PS C:\Users\Admin\go\src\github.com\openshift\odo> go test -count=1 pkg/project/project.go pkg/project/project_test.go pkg/project/types.go
# github.com/openshift/odo/vendor/github.com/kr/pty
vendor\github.com\kr\pty\shim.go:26:16: undefined: pty.Winsize
vendor\github.com\kr\pty\shim.go:32:63: undefined: pty.Getsize
vendor\github.com\kr\pty\shim.go:38:9: undefined: pty.GetsizeFull
vendor\github.com\kr\pty\shim.go:47:52: undefined: pty.InheritSize
vendor\github.com\kr\pty\shim.go:57:54: undefined: pty.Setsize
vendor\github.com\kr\pty\shim.go:64:60: undefined: pty.Start
vendor\github.com\kr\pty\shim.go:75:9: undefined: pty.StartWithSize
FAIL    command-line-arguments [build failed]
FAIL

Also tektoncd/cli#191 might help you find a solution.

@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Feb 14, 2020
@amitkrout
Copy link
Contributor

Netflix/go-expect#10 according to the issue, the go-expect library is not supported on windows. We are using the library here

https://github.com/openshift/odo/blob/bba04d2aeb8a4f02867b320d93554c70e7726072/glide.yaml#L46

in ODO. This is the reason build is failing on windows

PS C:\Users\Admin\go\src\github.com\openshift\odo> go test -count=1 pkg/project/project.go pkg/project/project_test.go pkg/project/types.go
# github.com/openshift/odo/vendor/github.com/kr/pty
vendor\github.com\kr\pty\shim.go:26:16: undefined: pty.Winsize
vendor\github.com\kr\pty\shim.go:32:63: undefined: pty.Getsize
vendor\github.com\kr\pty\shim.go:38:9: undefined: pty.GetsizeFull
vendor\github.com\kr\pty\shim.go:47:52: undefined: pty.InheritSize
vendor\github.com\kr\pty\shim.go:57:54: undefined: pty.Setsize
vendor\github.com\kr\pty\shim.go:64:60: undefined: pty.Start
vendor\github.com\kr\pty\shim.go:75:9: undefined: pty.StartWithSize
FAIL    command-line-arguments [build failed]
FAIL

Also tektoncd/cli#191 might help you find a solution.

Issue created - #2586 to track UTs failure travis CI on Win10 platform cc_ @prietyc123

@prietyc123 prietyc123 changed the title [WIP]Unit test on windows Unit test on windows Mar 6, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Mar 6, 2020
@@ -1,3 +1,6 @@
// +build !windows
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skip build for windows and macOS. Watch test will be revised in #2570 for windows and macOS.

@@ -1,3 +1,6 @@
// +build !windows
// +build !osx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@prietyc123 Can we make this in a single line ? For example

// +build !windows !osx

Copy link
Contributor Author

@prietyc123 prietyc123 Mar 6, 2020

Choose a reason for hiding this comment

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

@prietyc123 Can we make this in a single line ? For example

// +build !windows !osx

Done with // +build !windows,!osx

@prietyc123
Copy link
Contributor Author

/retest

@prietyc123
Copy link
Contributor Author

/test v4.3-integration-e2e-benchmark

@@ -1,3 +1,5 @@
// +build !windows,!osx
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skipping watch test build on windows and macOS. It will be revised in #2570

Copy link
Member

Choose a reason for hiding this comment

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

Skipping watch test build on windows and macOS. It will be revised in #2570

It would be good to add this as a comment to all skipped files.

@amitkrout
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 9, 2020
script:
- export PATH="$PATH:$GOPATH/bin"
- make bin
- rm -r /tmp/*
Copy link
Member

Choose a reason for hiding this comment

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

There is no /tmp on windows. How is this working? Is there some kind of conversion to windows paths?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kadel In travis minimal gnu for windows is set as a default terminal for running scripts. minimal gnu provides the similar Linux file system on windows platform. As per the gnu environment the temp file will be generated in /tmp directory. For example

Screen Shot 2020-03-10 at 4 16 56 PM

Screen Shot 2020-03-10 at 4 12 23 PM

So its good practice to remove the temp files before running the actual test.

Copy link
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Tests LGTM!

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdrage

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Mar 10, 2020
@openshift-merge-robot openshift-merge-robot merged commit 8c05b3d into redhat-developer:master Mar 10, 2020
@rm3l rm3l added the estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. estimated-size/M (10-20) Rough sizing for Epics. About 1 sprint of work for one person kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run unit test on windows and macOS
9 participants