Repository navigation
Run install.ps1 behavior tests on Windows - #208
Merged
Merged
Conversation
Builds stub release archives locally and serves them through an Invoke-WebRequest stand-in, then checks the default name, INSTALLED_NAME in either case, and reinstalling while the installed exe (or its moved-aside copy) is running, under Windows PowerShell 5.1 and PowerShell 7.
Each reinstall moved the existing exe to the fixed name <name>.exe.old. If the copy moved aside by an earlier reinstall was still running, that file could be neither deleted nor replaced, so the next reinstall failed with "Cannot create a file when that file already exists". Move the exe aside under a unique name instead and delete earlier copies that are no longer running.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
install.ps1had no test that executes it;install.shis covered bytests/install_sh_sudo_test.sh. This addstests/install_ps1_test.ps1and awindows-latestjob ininstall-scripts.ymlthat runs it under Windows PowerShell 5.1 and PowerShell 7.The test is hermetic: it
go builds a stubflashduty-cli.exeper version (it prints its version;sleepkeeps it running), zips it with achecksums.txt, and serves the archives through anInvoke-WebRequestfunction that shadows the cmdlet, so no network is used. Cases:flashduty.exeINSTALLED_NAME=fdutyinstallsfduty.exe;INSTALLED_NAME=FDUTY.EXEinstallsFDUTY.exeThe test found a bug: reinstalling while the copy moved aside by an earlier reinstall is still running failed with "Cannot create a file when that file already exists", because the exe was always moved to the fixed name
<name>.exe.old, which a running process locks.install.ps1now moves the exe aside under a unique<name>.exe.<guid>.oldand deletes earlier copies that are no longer running.The mirror job is unchanged.
🤖 Generated with Claude Code