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 failed windows tests that depends on cwd #160

Merged
merged 1 commit into from
Aug 13, 2022

Conversation

youyuanwu
Copy link
Member

@youyuanwu youyuanwu commented Aug 13, 2022

Signed-off-by: Youyuan Wu youyuanwu@outlook.com

Failed tests on master:

--- FAIL: TestNormalizer_NormalizeBase (0.00s)
    --- FAIL: TestNormalizer_NormalizeBase//base/sub/file.json (0.00s)
        normalizer_test.go:[41](https://github.com/go-openapi/spec/runs/7816924392?check_suite_focus=true#step:4:42)8: 
            	Error Trace:	normalizer_test.go:418
            	Error:      	Not equal: 
            	            	expected: "file:///c:/base/sub/file.json"
            	            	actual  : "file:///d:/base/sub/file.json"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-file:///c:/base/sub/file.json
            	            	+file:///d:/base/sub/file.json
            	Test:       	TestNormalizer_NormalizeBase//base/sub/file.json
            	Messages:   	for base "/base/sub/file.json"
    --- FAIL: TestNormalizer_NormalizeBase//.. (0.00s)
        normalizer_test.go:418: 
            	Error Trace:	normalizer_test.go:418
            	Error:      	Not equal: 
            	            	expected: "file:///c:"
            	            	actual  : "file:///d:"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-file:///c:
            	            	+file:///d:
            	Test:       	TestNormalizer_NormalizeBase//..
            	Messages:   	for base "/.."
    --- FAIL: TestNormalizer_NormalizeBase////folder//subfolder///file.json/ (0.00s)
        normalizer_test.go:418: 
            	Error Trace:	normalizer_test.go:418
            	Error:      	Not equal: 
            	            	expected: "file:///c:/folder/subfolder/file.json"
            	            	actual  : "file:///d:/folder/subfolder/file.json"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-file:///c:/folder/subfolder/file.json
            	            	+file:///d:/folder/subfolder/file.json
            	Test:       	TestNormalizer_NormalizeBase////folder//subfolder///file.json/
            	Messages:   	for base "///folder//subfolder///file.json/"

The cause of failure is that the tests were running in D:/ drive in stead of C:/ drive in github action.
Not sure the filepath.abs() changed behaviour or not. i.e. if it always returns C:/.

The fix is to change tests to have expected value matching the current drive.

Signed-off-by: Youyuan Wu <youyuanwu@outlook.com>
@casualjim casualjim merged commit a9843ac into master Aug 13, 2022
@casualjim casualjim deleted the dev/youyuanwu/fix-windows-broken-test branch August 13, 2022 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants