diff options
| author | Shulhan <ms@kilabit.info> | 2023-12-22 02:04:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-22 03:07:52 +0700 |
| commit | c0d336ca456093b2b7c0b585dbe08f62cbc8ca83 (patch) | |
| tree | cb313f0352a91562cc99ad115d62bad1447dc2b9 /sudo_test.go | |
| parent | 66a18a789edaa35dfa4446846eeeffabfee0b269 (diff) | |
| download | awwan-c0d336ca456093b2b7c0b585dbe08f62cbc8ca83.tar.xz | |
all: add [context.Context] to Local and Play
Passing context allow the command Local or Play to be cancelled when
running in asynchronous mode, in this case when awwan run with WUI.
Diffstat (limited to 'sudo_test.go')
| -rw-r--r-- | sudo_test.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sudo_test.go b/sudo_test.go index 2ad8be5..cf2de67 100644 --- a/sudo_test.go +++ b/sudo_test.go @@ -7,6 +7,7 @@ package awwan import ( "bytes" + "context" "testing" "github.com/shuLhan/share/lib/test" @@ -85,6 +86,8 @@ func TestExecLocal_sudo(t *testing.T) { }} var ( + ctx = context.Background() + c testCase stmt Statement x int @@ -98,7 +101,7 @@ func TestExecLocal_sudo(t *testing.T) { mockin.buf.WriteString(c.sudoPass) for x, stmt = range c.listStmt { - err = ExecLocal(req, &stmt) + err = ExecLocal(ctx, req, &stmt) if err != nil { t.Log(mockout.String()) var expError = c.expError[x] |
