diff --git a/workhorse/cmd/gitlab-workhorse/channel_test.go b/workhorse/cmd/gitlab-workhorse/channel_test.go index 6e8ad945fd2dc4430a5c267ec79a4aa38e941e43..11b414cc526c0d06a6ff61d4e8bb267751977f0b 100644 --- a/workhorse/cmd/gitlab-workhorse/channel_test.go +++ b/workhorse/cmd/gitlab-workhorse/channel_test.go @@ -174,7 +174,7 @@ func webSocketHandler(upgrader *websocket.Upgrader, connCh chan connWithReq) htt func channelOkBody(remote *httptest.Server, header http.Header, subprotocols ...string) *api.Response { out := &api.Response{ Channel: &api.ChannelSettings{ - WsURL: websocketURL(remote.URL), + Url: websocketURL(remote.URL), Header: header, Subprotocols: subprotocols, MaxSessionTime: 0, diff --git a/workhorse/internal/api/channel_settings.go b/workhorse/internal/api/channel_settings.go index 6e8d2f13b07129e65b587206f6e5030060f3be17..779d2ad7e691ff032a40ee5bb9571108dd9e64bc 100644 --- a/workhorse/internal/api/channel_settings.go +++ b/workhorse/internal/api/channel_settings.go @@ -19,7 +19,7 @@ type ChannelSettings struct { Subprotocols []string // The websocket URL to connect to. - WsURL string + Url string //nolint:revive,stylecheck // when JSON decoding, the value is provided via 'url' // Any headers (e.g., Authorization) to send with the websocket request Header http.Header @@ -35,7 +35,7 @@ type ChannelSettings struct { // URL parses the websocket URL in the ChannelSettings and returns a *url.URL. func (t *ChannelSettings) URL() (*url.URL, error) { - return url.Parse(t.WsURL) + return url.Parse(t.Url) } // Dialer returns a websocket Dialer configured with the settings from ChannelSettings. @@ -72,7 +72,7 @@ func (t *ChannelSettings) Clone() *ChannelSettings { // Dial establishes a websocket connection using the settings from ChannelSettings. // It returns a websocket connection, an HTTP response, and an error if any. func (t *ChannelSettings) Dial() (*websocket.Conn, *http.Response, error) { - return t.Dialer().Dial(t.WsURL, t.Header) + return t.Dialer().Dial(t.Url, t.Header) } // Validate checks if the ChannelSettings instance is valid. @@ -133,7 +133,7 @@ func (t *ChannelSettings) IsEqual(other *ChannelSettings) bool { } } - return t.WsURL == other.WsURL && + return t.Url == other.Url && t.CAPem == other.CAPem && t.MaxSessionTime == other.MaxSessionTime } diff --git a/workhorse/internal/api/channel_settings_test.go b/workhorse/internal/api/channel_settings_test.go index d33d78222d24eb073acf6bcfde2fe158182b058c..1735a8b6e3d778c79f3e07bc6b05607795859f2c 100644 --- a/workhorse/internal/api/channel_settings_test.go +++ b/workhorse/internal/api/channel_settings_test.go @@ -9,7 +9,7 @@ import ( func channel(url string, subprotocols ...string) *ChannelSettings { return &ChannelSettings{ - WsURL: url, + Url: url, Subprotocols: subprotocols, MaxSessionTime: 0, } @@ -146,7 +146,7 @@ func TestIsEqual(t *testing.T) { {chann, chann, true}, {chann.Clone(), chann.Clone(), true}, {chann, channel("foo:"), false}, - {chann, channel(chann.WsURL), false}, + {chann, channel(chann.Url), false}, {header(chann), header(chann), true}, {channHeader2, channHeader2, true}, {channHeader3, channHeader3, true}, diff --git a/workhorse/internal/channel/auth_checker_test.go b/workhorse/internal/channel/auth_checker_test.go index 36a45b07c1e2c0f847a32283c4c7aa820aa3a049..b522cf5da1fff3b90c59e7812e084fe1e3bed92d 100644 --- a/workhorse/internal/channel/auth_checker_test.go +++ b/workhorse/internal/channel/auth_checker_test.go @@ -19,7 +19,7 @@ func checkerSeries(values ...*api.ChannelSettings) AuthCheckerFunc { } func TestAuthCheckerStopsWhenAuthFails(t *testing.T) { - template := &api.ChannelSettings{WsURL: "ws://example.com"} + template := &api.ChannelSettings{Url: "ws://example.com"} stopCh := make(chan error) series := checkerSeries(template, template, template) ac := NewAuthChecker(series, template, stopCh) @@ -35,9 +35,9 @@ func TestAuthCheckerStopsWhenAuthFails(t *testing.T) { } func TestAuthCheckerStopsWhenAuthChanges(t *testing.T) { - template := &api.ChannelSettings{WsURL: "ws://example.com"} + template := &api.ChannelSettings{Url: "ws://example.com"} changed := template.Clone() - changed.WsURL = "wss://example.com" + changed.Url = "wss://example.com" stopCh := make(chan error) series := checkerSeries(template, changed, template) ac := NewAuthChecker(series, template, stopCh)