Run expect script on windows CI
CI env is https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md
The expect test is done from here https://github.com/wader/fq/blob/master/Makefile#L24 using https://github.com/wader/fq/blob/master/pkg/cli/test.sh and https://github.com/wader/fq/blob/master/pkg/cli/test.exp. The shell script is helper around the expect script to be able to pass a fq binary to test and also to be silent on success and print log if not.
The windows image has make and bash so hopefully it is mostly about installing expect and then checking if expect.exe is in path?
@thushan
FYI files got renamed and changed a bit in #198, also once again learned that it's tricky to have robust expect scripts hmm
Sorry got distracted by other things. Didn't expect setting up expect on Windows to be non-trivial! Going to give it a crack tonight but the setup you've got seems quite straight forward.
Hehe no worries, i did a quick check if expect is available in some nice package form for windows but no success. Yeap give it a try or if you know some other tool for testing feel free to use that, i just happened to have some previous experience with expect
heh yeah, though I may have a solution via TCL (ActiveState's TCL)
$ choco install activetcl
$ teapot install Expect
Will have to see how this goes.
Oh yes that sounds promising. A bit worried about the expect script, i've already experienced it behaving differently between linux environtments so i guess we will see how it goes in windows :(
yeah, i was going to suggest a move to a multi-platform expect like tool... but wasn't sure what The Great Expectation would be just yet.
Short lived, choco was busted, ActiveState's TCL's expect isn't compatible with Windows.

Will look at alternatives.
Hmm "Remove Windows"? that is a bold suggestion :)
Hey, curious if you made any progress?
Hey, missed this email. Went down a rabbit hole to find a portable expect that works on Unix and Windows, looked at some python alternatives (hangon, stay with me!) with wexpect and pexpect.
I've had some issues to overcome porting your stuff but will hopefully be able to get sometime this weekend to look into it. pexpect looks to be the winner at this stage.
Ideally, if I can prove it works with minimal maintenance across both platforms, would be good. Surprised that there's no native way in Windows. Expect more!
No worries, nice! One test i would like to add for windows is file path handling, just check that path with driver name and backslash works as intended, maybe both absolute and relative. There was a regression breaking that once.
Great use case. I'll add that to my list.
Had sometime today to get this going properly. Ported the basic scripts over to pexpect (wexpect was not consistent). This is a WIP.
Started with the easiest...
test_cli_ctrlc.exp => test_cli_ctrlc.py
test_cli_ctrld.exp => test_cli_ctrld.py
Running these on Windows requires a bit of rework because they have a separate API (PopenSpawn).
Will hammer away at it, but I was thinking of moving these to isolate them from the rest of the go code (being purely CI activities) do you have a suggested location for these (+ the requirements.txt).
Maybe in a root under a folder meaningful for CI activities?
Eek, the Windows support is quite flaky with pexpect too unfortunately. Will park this for the moment.
Maybe in a root under a folder meaningful for CI activities?
No sure, i do use the expect tests outside CI also and i kind of like the go way of keeping tests close to the code it tests (same directory), but yeah maybe can get cluttered with python stuff... maybe could be in a subdirectory of pkg/cli?
Eek, the Windows support is quite flaky with pexpect too unfortunately. Will park this for the moment.
Ok! thanks for giving it a try. Yeap, let it rest a bit and see if you come up with something
@thushan close for now or you think you will have a go again soon? trying to clean up issues a bit
Yeah I think so mate. Had Great Expectations but the tooling may not be ready for this yet and I haven't looked into it any further. If someone does come across this months & years from now, maybe something to try. A bit like The Hobbit - The Unexpected Journey.
:) No worries and understood, thanks for taking some time to look into it