-
Notifications
You must be signed in to change notification settings - Fork 212
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
UnitTests fail on windows due to path formatting problems #2855
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
034edd6
fixed 1 test
ludfjig b4a34f2
another one
ludfjig d08301c
another one
ludfjig cc65cb3
more
ludfjig b5861b2
more tests
ludfjig 99db6eb
more
ludfjig c02f200
added help function
ludfjig 17565e0
more tests, TODO: make prettier
ludfjig eaa7e0b
windows expected file
ludfjig 35cb9c7
only one test left
ludfjig dbc10bc
final test
ludfjig 28e1800
code smell
ludfjig ba62ba4
undo linebreak change
ludfjig 0fdd838
some feedback
ludfjig 9d3a9fa
more feedback and fixes
ludfjig e39387a
code smell
ludfjig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ package porter | |
import ( | ||
"context" | ||
"errors" | ||
"runtime" | ||
"testing" | ||
"time" | ||
|
||
"get.porter.sh/porter/pkg" | ||
"get.porter.sh/porter/pkg/cache" | ||
|
@@ -34,12 +36,10 @@ func TestPublish_Validate_PorterYamlDoesNotExist(t *testing.T) { | |
|
||
opts := PublishOptions{} | ||
err := opts.Validate(p.Config) | ||
require.Error(t, err, "validation should have failed") | ||
assert.EqualError( | ||
require.ErrorContains( | ||
t, | ||
err, | ||
"could not find porter.yaml in the current directory /, make sure you are in the right directory or specify the porter manifest with --file", | ||
"porter.yaml not present so should have failed validation", | ||
"could not find porter.yaml in the current directory", | ||
) | ||
} | ||
|
||
|
@@ -51,7 +51,7 @@ func TestPublish_Validate_ArchivePath(t *testing.T) { | |
ArchiveFile: "mybuns.tgz", | ||
} | ||
err := opts.Validate(p.Config) | ||
assert.EqualError(t, err, "unable to access --archive mybuns.tgz: open /mybuns.tgz: file does not exist") | ||
assert.ErrorContains(t, err, "file does not exist") | ||
|
||
p.FileSystem.WriteFile("mybuns.tgz", []byte("mybuns"), pkg.FileModeWritable) | ||
err = opts.Validate(p.Config) | ||
|
@@ -225,6 +225,11 @@ func TestPublish_RefreshCachedBundle(t *testing.T) { | |
require.NoError(t, err) | ||
origBunPathTime := file.ModTime() | ||
|
||
if runtime.GOOS == "windows" { | ||
// see https://github.com/getporter/porter/issues/2858 | ||
time.Sleep(5 * time.Millisecond) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :-( we've seen this in k8s too |
||
} | ||
|
||
// Should refresh cache | ||
err = p.refreshCachedBundle(bundleRef) | ||
require.NoError(t, err, "should have successfully updated the cache") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Writing logs to C:\.porter\logs\0.json | ||
a thing happened | ||
a weird thing happened | ||
a bad thing happened |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can separate expected output by a newline character, so for this test there are two possible expected outputs which both pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh interesting, might be easier to read if it is separated into array for the want command? maybe it isn't possible, not sure how the testing framework works.