From 45e3a62e231424caf9f1b4dd83c85d0519c4d578 Mon Sep 17 00:00:00 2001 From: yanggang Date: Wed, 11 Jan 2023 06:54:03 +0800 Subject: [PATCH] build: bump golang 1.19.4 -> 1.19.5 Signed-off-by: yanggang --- .go-version | 2 +- topdown/http_test.go | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.go-version b/.go-version index 843f863534..83d5e73f00 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.19.4 +1.19.5 diff --git a/topdown/http_test.go b/topdown/http_test.go index ddec40605c..dc364d5607 100644 --- a/topdown/http_test.go +++ b/topdown/http_test.go @@ -129,24 +129,23 @@ func TestHTTPGetRequestTlsInsecureSkipVerify(t *testing.T) { resultObj := ast.MustInterfaceToValue(expectedResult) - // run the test - tests := []struct { - note string - rules []string - expected interface{} - expectedError error - }{ - {note: "http.send", rules: []string{fmt.Sprintf( - `p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true}, x) }`, ts.URL)}, expected: &Error{Message: fixupDarwinGo118("x509: certificate signed by unknown authority", `x509: “Acme Co” certificate is not trusted`)}}, - {note: "http.send", rules: []string{fmt.Sprintf( - `p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()}, - // This case verifies that `tls_insecure_skip_verify` - // is still applied, even if other TLS settings are - // present. - {note: "http.send", rules: []string{fmt.Sprintf( - `p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true, "tls_use_system_certs": true,}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()}, + type httpsStruct struct { + note string + rules []string + expected interface{} } + // run the test + tests := []httpsStruct{} + tests = append(tests, httpsStruct{note: "http.send", rules: []string{fmt.Sprintf( + `p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()}) + + // This case verifies that `tls_insecure_skip_verify` + // is still applied, even if other TLS settings are + // present. + tests = append(tests, httpsStruct{note: "http.send", rules: []string{fmt.Sprintf( + `p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true, "tls_use_system_certs": true,}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()}) + data := loadSmallTestData() for _, tc := range tests {