remotemobprogramming / mob

Tool for smooth git handover.
https://mob.sh
MIT License
1.66k stars 147 forks source link

Fix tests on Windows #340

Closed balintf closed 1 year ago

balintf commented 1 year ago

This PR fixes #339. It removes the run function from mob_test.go and replaces the usages with go os.* calls. The PR also fixes gitRootDir() comparisons on Windows and the Unix touch utility usage in TestStartNextStay_DoNotWriteLastModifiedFileInCommit_WhenFileIsMoved .

hollesse commented 1 year ago

Thank you! I really appreciate your contributions! It makes it much easier for us, as neither @gregorriegler nor I don't use a windows machine :)

balintf commented 1 year ago

Thank you! I really appreciate your contributions! It makes it much easier for us, as neither @gregorriegler nor I don't use a windows machine :)

Thanks for the kind words :) I'm happy to help, I use Windows as my main development machine, but I try to get my code to work correctly on Linux and Mac as well. For me Mac testing is a bit harder, since I don't use it daily.

balintf commented 1 year ago

I think the failure on (ubuntu-latest, latest) is due to some flakiness in the testcase. I've run it again on my fork, and it succeeds there with the same code and ci settings: https://github.com/balintf/mob/actions/runs/3333654949

One guess would be that the file creation done by touch %s-1 is not visible immediately to the git status --short command, a sync command between them might help, but I'm not sure about it.

hollesse commented 1 year ago

I think the failure on (ubuntu-latest, latest) is due to some flakiness in the testcase. I've run it again on my fork, and it succeeds there with the same code and ci settings: https://github.com/balintf/mob/actions/runs/3333654949

One guess would be that the file creation done by touch %s-1 is not visible immediately to the git status --short command, a sync command between them might help, but I'm not sure about it.

We could also adjust the test to use test.Await() but thats a different topic. I will just restart the job for now.