aboutsummaryrefslogtreecommitdiff
path: root/http_server_play_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-22 13:16:21 +0700
committerShulhan <ms@kilabit.info>2023-12-01 13:17:30 +0700
commita73f0d5d0108e2e10d89f93c7867addbe073add9 (patch)
tree042e69e2c1d10d836a006abca37417af02bba826 /http_server_play_test.go
parenta9701f66c2e38a3a7f3d12deed6ebba5144e208e (diff)
downloadawwan-a73f0d5d0108e2e10d89f93c7867addbe073add9.tar.xz
all: refactoring HTTP endpoint for Execute
Previously, the Execute endpoint wait for command execution to finish. In case the command takes longer than proxy or server write timeout, it will return with an timeout error to client. In this changes, we generate an execution ID for each request and return it immediately. The next commit will implement HTTP endpoint to fetch the latest status and/or output by execution ID. References: https://todo.sr.ht/~shulhan/awwan/5
Diffstat (limited to 'http_server_play_test.go')
-rw-r--r--http_server_play_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/http_server_play_test.go b/http_server_play_test.go
index 1879ec8..df9f4f3 100644
--- a/http_server_play_test.go
+++ b/http_server_play_test.go
@@ -13,6 +13,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
+ "strings"
"testing"
libhttp "github.com/shuLhan/share/lib/http"
@@ -26,12 +27,13 @@ import (
//
// This will cause the awwan play failed with empty SSH host,
//
-// - play.aww --- SSH connection: @:22
+// --- SSH connection: @:22
//
// or an error,
//
-// !!! initSSHClient: NewClientInteractive: dialWithSigners: ssh: handshake
-// failed: knownhosts: key is unknown from known_hosts files
+// !!! initSSHClient: NewClientInteractive: dialWithSigners: ssh:
+// handshake failed: knownhosts: key is unknown from known_hosts
+// files
func TestHttpServerPlaySshConfigChanges(t *testing.T) {
var (
baseDir = `testdata/http_server/play_ssh_config_changes`
@@ -125,5 +127,5 @@ func testHttpExecute(t *testing.T, httpd *httpServer, tdata *test.Data, tag stri
}
expResp = tdata.Output[tag+`:output`]
- test.Assert(t, tag+`:output`, string(expResp), string(execRes.Output))
+ test.Assert(t, tag+`:output`, string(expResp), strings.Join(execRes.Output, "\n"))
}