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 /awwan_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 'awwan_sudo_test.go')
| -rw-r--r-- | awwan_sudo_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/awwan_sudo_test.go b/awwan_sudo_test.go index cc7bcc3..ae112f7 100644 --- a/awwan_sudo_test.go +++ b/awwan_sudo_test.go @@ -7,6 +7,7 @@ package awwan import ( "bytes" + "context" "io/fs" "os" "path/filepath" @@ -84,6 +85,7 @@ func TestAwwan_Local_SudoGet(t *testing.T) { }} var ( + ctx = context.Background() script = filepath.Join(baseDir, `get.aww`) mockin = &mockStdin{} @@ -105,7 +107,7 @@ func TestAwwan_Local_SudoGet(t *testing.T) { mockin.buf.WriteString(c.sudoPass) req.stdin = mockin - err = aww.Local(req) + err = aww.Local(ctx, req) if err != nil { test.Assert(t, `Local: error`, c.expError, err.Error()) continue @@ -179,6 +181,7 @@ func TestAwwan_Local_SudoPut(t *testing.T) { }} var ( + ctx = context.Background() mockin = &mockStdin{} mockout = &bytes.Buffer{} mockTerm = mock.ReadWriter{} @@ -214,7 +217,7 @@ func TestAwwan_Local_SudoPut(t *testing.T) { mockin.buf.WriteString(c.sudoPass) req.stdin = mockin - err = aww.Local(req) + err = aww.Local(ctx, req) if err != nil { test.Assert(t, `Local error`, c.expError, err.Error()) continue |
