Fix initialism errors (PR-2) (#17032)
* Fix initialism errors * Fix check-mocks test * Revert mlog and filestore packages * Update plugin_hooks_test.go * Update opentracinglayer.go * Regenerate mocks and check store layers * Revert plugin's context changes * Update context.go * Update plugin_requests.go * Update plugin_hooks_test.go * Regenerate mocks * Regenerate mocks and store layers Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
db01f2a91b
Коммит
343c51830f
@@ -67,7 +67,7 @@ func TestHTTPClient(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
allowHost func(string) bool
|
||||
allowIp func(net.IP) bool
|
||||
allowIP func(net.IP) bool
|
||||
expectedAllowed bool
|
||||
}{
|
||||
{"allow with no checks", nil, nil, true},
|
||||
@@ -84,7 +84,7 @@ func TestHTTPClient(t *testing.T) {
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
c := NewHTTPClient(NewTransport(false, testCase.allowHost, testCase.allowIp))
|
||||
c := NewHTTPClient(NewTransport(false, testCase.allowHost, testCase.allowIP))
|
||||
if _, err := c.Get(mockHTTP.URL); testCase.expectedAllowed {
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ var ErrNotEnabled = Error{errors.New("imageproxy.ImageProxy: image proxy not ena
|
||||
// using MakeImageProxy which requires a configService and an HTTPService provided by the server.
|
||||
type ImageProxy struct {
|
||||
ConfigService configservice.ConfigService
|
||||
configListenerId string
|
||||
configListenerID string
|
||||
|
||||
HTTPService httpservice.HTTPService
|
||||
|
||||
@@ -56,7 +56,7 @@ func MakeImageProxy(configService configservice.ConfigService, httpService https
|
||||
siteURL, _ := url.Parse(*configService.Config().ServiceSettings.SiteURL)
|
||||
proxy.siteURL = siteURL
|
||||
|
||||
proxy.configListenerId = proxy.ConfigService.AddConfigListener(proxy.OnConfigChange)
|
||||
proxy.configListenerID = proxy.ConfigService.AddConfigListener(proxy.OnConfigChange)
|
||||
|
||||
config := proxy.ConfigService.Config()
|
||||
proxy.backend = proxy.makeBackend(*config.ImageProxySettings.Enable, *config.ImageProxySettings.ImageProxyType)
|
||||
@@ -83,7 +83,7 @@ func (proxy *ImageProxy) Close() {
|
||||
proxy.lock.Lock()
|
||||
defer proxy.lock.Unlock()
|
||||
|
||||
proxy.ConfigService.RemoveConfigListener(proxy.configListenerId)
|
||||
proxy.ConfigService.RemoveConfigListener(proxy.configListenerID)
|
||||
}
|
||||
|
||||
func (proxy *ImageProxy) OnConfigChange(oldConfig, newConfig *model.Config) {
|
||||
|
||||
@@ -26,11 +26,11 @@ type Client struct {
|
||||
// NewClient creates a client to the marketplace server at the given address.
|
||||
func NewClient(address string, httpService httpservice.HTTPService) (*Client, error) {
|
||||
var httpClient *http.Client
|
||||
addressUrl, err := url.Parse(address)
|
||||
addressURL, err := url.Parse(address)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to parse marketplace address")
|
||||
}
|
||||
if addressUrl.Hostname() == "localhost" || addressUrl.Hostname() == "127.0.0.1" {
|
||||
if addressURL.Hostname() == "localhost" || addressURL.Hostname() == "127.0.0.1" {
|
||||
httpClient = httpService.MakeClient(true)
|
||||
} else {
|
||||
httpClient = httpService.MakeClient(false)
|
||||
|
||||
Ссылка в новой задаче
Block a user