aboutsummaryrefslogtreecommitdiff
path: root/testdata/local
AgeCommit message (Collapse)Author
2026-02-15all: fix chmod/chown if destination is directoryShulhan
Given the following command #put!+0644 src/file dst/ If the dst is a directory, it would cause the directory permission changes to 0644. This changes fix it by checking if the destination is a directory first. If we cannot stat the dst, skip the chmod/chown command.
2026-02-06all: use space log prefix instead of dummy dateShulhan
Using dummy date make the test output hard to read in verbose option, because the program logs mixed with the test logs.
2026-02-06all: use separate buffer for stdout and stderr in TestAwwanLocalShulhan
This is to fix flaky test on TestAwwanLocal.
2026-02-03all: fix data race in tests and [httpServer.ExecuteTail]Shulhan
In the test for AwwanLocal, use buffer with lock, so each write and read is safe. In the httpServer, the test found data race during ExecuteTail when accessing [ExecResponse.EndAt]. We fix it by locking the resource during call to end() and when accessing the EndAt field.
2025-10-03all: add option "$noparse" for magic "#put" commandShulhan
The "$noparse" option allow copying file without reading and parsing the input file.
2025-01-12all: update machine container setup with latest ArchShulhan
The latest mkosi use importctl instead of machinectl to import the image. There is an issue in mkosi.conf where build with Format=tar always get compressed using zstd, but importctl unable to import it, so we need to set CompressOutput=false. The home directory mode needs to be set to open 0755, because now its default to 0700, which makes the test failed to read file on others user's home. The pacman mirror changes to public one that is always available, geo.mirror.pkgbuild.com. The BUG_REPORT_URL in os-release for Arch changes which we need to modify because its included in the test-container.
2023-12-22all: add [context.Context] to Local and PlayShulhan
Passing context allow the command Local or Play to be cancelled when running in asynchronous mode, in this case when awwan run with WUI.
2023-12-21all: changes default date-time prefix on testShulhan
Using "-" as dummy date-time prefix make the test output quite hard to read, especially since we use the same prefix "===" and "---" with Go test output.
2023-12-18all: fix panic due to out of range when running "#require" statementShulhan
2023-12-16all: make the magic line "#put:" use explicit source for encrypted fileShulhan
Previously, the magic line "#put" detect whether the source file is encrypted or not automatically, so we did not need to put ".vault" suffix in the source path. This changes make it to be always explicit. If we want to copy encrypted file than the source file must be the path to encrypted file. Implements: https://todo.sr.ht/~shulhan/awwan/7
2023-12-14all: make the magic line "#local" works on "local" command tooShulhan
In case we have a script that manage local host and remote server, calling "play" on "#local" lines only always open the connection to remote server. To minimize opening unused connections, let the "#local" command works on both commands. Its up to user which part of lines that they want to execute on remote or local.
2023-12-01all: move wrapping BEGIN and END outside of sessionShulhan
2023-12-01all: remove script name in the log prefixShulhan
Since each execution now logged in the file with ".log" extension, there is no need to prefix it with script name again, because its redundant.
2023-10-30all: refactoring Local and Play so that error get loggedShulhan
Previously, if there is any error from Local or Play before any statement get executed it will not logged to log, also the Request close() is not called since we put it as defer in the middle. This changes fix this by moving down error handler into single exit goto label.
2023-10-30all: add begin and end for each script executionShulhan
When the script executed, log the script and line number to be executed with "=== BEGIN", and when its finished, log the end of it with "=== END". This is to make the log more traceable.
2023-10-30all: log all execution into fileShulhan
For each script execution, a file suffixed with ".log" will be created in the same directory with the same name as script file. For example, if the script is path is "a/b/c.aww" then the log file would named "a/b/c.aww.log". This is to provides history and audit in the future.
2023-10-26all: use "mlog.MultiLogger" to log Request output and errorShulhan
By using "mlog.MultiLogger" every output or error can be written to stdout/stderr and additional log writer that can collect both of them, buffered and returned to the caller. This changes simplify the HttpResponse to use only single output that combine both stdout and stderr.
2023-10-25all: log and simplify error when source file is not existShulhan
Previously, if the source file to be copied is not exist, awwan will output only error for the ".vault" file, twice, for example !!! Copy: <source>.vault: open <source>.vault not exist Local: Copy: <source>.vault: open <source>.vault not exist This changes make the first line output to print the original source file first, the non-ecrypted one, and then followed by encrypted one, ??? loadFileInput "<source>": not exist Local: Copy "<source>.vault": not exist
2023-10-22all: add magic command "#local"Shulhan
The magic command "#local" define the command to be executed using shell in local environment. Its have effect and can only be used in script that executed using "play". In script that is executed using "local" it does nothing.
2023-10-21all: implement local "#get!" and "#put!" with owner and modeShulhan
In local environment, using magic command "#get!" or "#put!" with owner and mode set, like "#get:$USER:$GROUP+$MODE" or "#put:$USER:$GROUP+MODE", will changes the file owner to $USER or $GROUP and/or permission to $MODE.
2023-10-21all: implement local "#get:" and "#put:" with owner and modeShulhan
In local environment, using magic command "#get" or "#put" with mode like "#get:$USER:$GROUP+$MODE" or "#put:$USER:$GROUP+MODE" will changes the file owner to $USER or $GROUP and/or permission to $MODE. The file owner does not works if user does not have permission to changes the owner.
2023-10-14all: add integration tests for local "#put!"Shulhan
2023-10-12all: add integration tests for magic command "#get!"Shulhan
2023-10-12all: return error from executeScriptOnLocalShulhan
Instead of breaking the statement when its failed to execute, return the error to the caller, Local.
2023-10-06all: simplify parsing statement for magic command getShulhan
This changes minimize code duplication when parsing magic command between "#get:" and "#get!" using single function parseStatementGetPut. In the returned Statement, we changes where to store the source argument into args[0] instead of in cmd for better readability and minimize confusion in Copy/SudoCopy. While at it, we add unit test for "#get:". Unit test for "#get!" is not possible right now, because it will prompt for password.
2023-09-27all: print any path relative to base directoryShulhan
This is to minimize log length in stdout and stderr, which make it more readable.
2023-09-27all: add tests for local with empty and invalid passphraseShulhan
While at it, rename the script for testing encrypted value to allow other tests without encryption later.
2023-09-27all: make .Vars, .Val, and .Vals panic if values is emptyShulhan
This is to prevent copying or executing command with value that are not defined or typo which make the result empty and may result in undefined behaviour. For example if we have "app_dir = /data/app" and command in the script that remove that directory recursively, sudo rm -r {{.Val "::app_dir}}/bin will result removing "/bin" entirely.
2023-09-27all: change default path for private key to be located under .ssh directoryShulhan
Using hidden file (with "." prefix in name) cluttering the workspace directory. Since we already have ".ssh" as indicator of workspace, we should use it, the same principal that ~/.ssh/ store user's private key.
2023-09-26testdata: rename "encrypt" to "local"Shulhan
We change the directory name because the "encrpyt" is not specific to encryption only but only for local.