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 integration tests on windows #2912

Merged
merged 5 commits into from
Sep 21, 2023

Conversation

ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Sep 18, 2023

What does this change

Fixes integration tests so they pass on windows . Also fixes a bug where porter archive fails on windows due to not being able to create a temp directory, because it tried to create 2 nesting levels at once.

One windows bug remains which is tracked separately, see #2917

What issue does it fix

Closes #2908

If there is not an existing issue, please make sure we have context on why this change is needed. See our Contributing Guide for examples of when an existing issue isn't necessary.

Notes for the reviewer

Please review agent.go. I have removed printing out the filecontents, because on windows there is no way to determine if a file is executable or not. I would like confirmation that this is ok (or not).

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

…e TestResolveBundleReference TestInstall_stringParam

Signed-off-by: Ludvig Liljenberg <[email protected]>
Signed-off-by: Ludvig Liljenberg <[email protected]>
@ludfjig ludfjig changed the title Win integrationtest Fix integration tests on windows Sep 18, 2023
@@ -336,6 +336,9 @@ func (ex *exporter) addImage(base bundle.BaseImage) error {
// If the name contains a path separator, all path separators will be replaced with "-".
func (ex *exporter) createArchiveFolder(name string) (string, error) {
cleanedPath := strings.ReplaceAll(afero.UnicodeSanitize(name), string(os.PathSeparator), "-")
cleanedPath = strings.ReplaceAll(cleanedPath, "/", "-") // this is needed because on windows, if the bundle name is from a reference
// e.g. "ghcr.io/getporter/examples/porter-hello:v0.2.0", the name will be "examples/porter-hello",
// so we still need to replace the / with -, which the above line doesn't do (on 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.

I'm wondering why this respected the OS's PathSeparator to begin with...?

Copy link
Contributor Author

@ludfjig ludfjig Sep 18, 2023

Choose a reason for hiding this comment

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

We should just use '/', no need for checking PathSeparator here. I don't believe a bundle name will ever have the name example\\hello-porter. https://github.com/getporter/porter/pull/2154/files

Signed-off-by: Ludvig Liljenberg <[email protected]>
@schristoff
Copy link
Member

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@schristoff schristoff left a comment

Choose a reason for hiding this comment

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

Awesome job! I can't tell if I kicked off integration or not but I'll set this to merge if integ is happy

@schristoff schristoff enabled auto-merge (squash) September 21, 2023 20:01
@schristoff schristoff merged commit 2dc17e1 into getporter:main Sep 21, 2023
17 checks passed
@ludfjig ludfjig deleted the win_integrationtest branch September 21, 2023 22:20
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.

Integration Tests fail on Windows
2 participants