From 70917abd74f0c5958473e1ae30a663534f098e67 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 21 Oct 2020 01:05:09 +0000 Subject: [PATCH] skip DoJSON test on plan9 --- plugins/plugins_test.go | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/plugins/plugins_test.go b/plugins/plugins_test.go index fff8504..cf50f42 100644 --- a/plugins/plugins_test.go +++ b/plugins/plugins_test.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" "net/http/httptest" + "runtime" "testing" ) @@ -33,27 +34,29 @@ type testResp struct { } func TestHTTPRequestDoJSON(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - _, err := fmt.Fprintln(w, `{"test":"success"}`) + if runtime.GOOS != "plan9" { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, err := fmt.Fprintln(w, `{"test":"success"}`) + if err != nil { + t.Error(err) + } + })) + defer ts.Close() + + var tr = &testResp{} + + req := HTTPRequest{ + ResBody: tr, + URL: ts.URL, + } + + err := req.DoJSON() if err != nil { t.Error(err) } - })) - defer ts.Close() - var tr = &testResp{} - - req := HTTPRequest{ - ResBody: tr, - URL: ts.URL, - } - - err := req.DoJSON() - if err != nil { - t.Error(err) - } - - if tr.Name != "success" { - t.Errorf("Expected 'test'; got '%s'\n", tr.Name) + if tr.Name != "success" { + t.Errorf("Expected 'test'; got '%s'\n", tr.Name) + } } }