diff options
author | Tiago Natel de Moura <t.nateldemoura@f5.com> | 2020-05-28 14:59:52 +0100 |
---|---|---|
committer | Tiago Natel de Moura <t.nateldemoura@f5.com> | 2020-05-28 14:59:52 +0100 |
commit | 08b765ae4289f399bb3642d327ccf402efca3537 (patch) | |
tree | 972afb5db99730305f22c71a05bd319a9ad526a7 /test/go/ns_inspect | |
parent | e2b53e16c60ba1e3bbbe59172c184e97f889326b (diff) | |
download | unit-08b765ae4289f399bb3642d327ccf402efca3537.tar.gz unit-08b765ae4289f399bb3642d327ccf402efca3537.tar.bz2 |
Tests: Added rootfs tests.
Diffstat (limited to '')
-rw-r--r-- | test/go/ns_inspect/app.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/go/ns_inspect/app.go b/test/go/ns_inspect/app.go index d9b561c9..4d19a796 100644 --- a/test/go/ns_inspect/app.go +++ b/test/go/ns_inspect/app.go @@ -21,10 +21,11 @@ type ( } Output struct { - PID int - UID int - GID int - NS NS + PID int + UID int + GID int + NS NS + FileExists bool } ) @@ -64,6 +65,18 @@ func handler(w http.ResponseWriter, r *http.Request) { CGROUP: getns("cgroup"), }, } + + err := r.ParseForm() + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } + + if fname := r.Form.Get("file"); fname != "" { + _, err = os.Stat(fname); + out.FileExists = err == nil + } + data, err := json.Marshal(out) if err != nil { w.WriteHeader(http.StatusInternalServerError) |