mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 23:42:41 +01:00
[GITEA] Fix test TestWebhookProxy
with http proxy env
- Unset the http proxies environments for the `TestWebhookProxy`. - Resolves #2132 (cherry picked from commit244b9786fc
) (cherry picked from commit8602dfa6a2
) (cherry picked from commit8621449209
) (cherry picked from commitaefa77f917
)
This commit is contained in:
parent
2bdab5e400
commit
2baec139fa
1 changed files with 7 additions and 0 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -25,9 +26,15 @@ import (
|
||||||
|
|
||||||
func TestWebhookProxy(t *testing.T) {
|
func TestWebhookProxy(t *testing.T) {
|
||||||
oldWebhook := setting.Webhook
|
oldWebhook := setting.Webhook
|
||||||
|
oldHTTPProxy := os.Getenv("http_proxy")
|
||||||
|
oldHTTPSProxy := os.Getenv("https_proxy")
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
setting.Webhook = oldWebhook
|
setting.Webhook = oldWebhook
|
||||||
|
os.Setenv("http_proxy", oldHTTPProxy)
|
||||||
|
os.Setenv("https_proxy", oldHTTPSProxy)
|
||||||
})
|
})
|
||||||
|
os.Unsetenv("http_proxy")
|
||||||
|
os.Unsetenv("https_proxy")
|
||||||
|
|
||||||
setting.Webhook.ProxyURL = "http://localhost:8080"
|
setting.Webhook.ProxyURL = "http://localhost:8080"
|
||||||
setting.Webhook.ProxyURLFixed, _ = url.Parse(setting.Webhook.ProxyURL)
|
setting.Webhook.ProxyURLFixed, _ = url.Parse(setting.Webhook.ProxyURL)
|
||||||
|
|
Loading…
Reference in a new issue