Skip to content

Commit

Permalink
Updates CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Sep 14, 2024
1 parent 4e62bc6 commit 378499a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Code Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.59.1
version: v1.60.1
- name: Build
run: go build -v ./...
- name: Test
Expand Down
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ linters-settings:
- performance
- style
govet:
check-shadowing: true
enable:
- fieldalignment
nolintlint:
Expand All @@ -34,7 +33,7 @@ linters:
- gocritic
- gofmt
- goimports
- gomnd
- mnd
- gocyclo
- gosec
- gosimple
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ func (m *mockInput) Close() {}
func TestNewCLI(t *testing.T) {
server := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {
var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand Down Expand Up @@ -82,8 +84,10 @@ func TestNewCLI(t *testing.T) {
func TestNewCLIRunWithCommands(t *testing.T) {
server := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {
var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/macro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ func TestMacro_Get(t *testing.T) {
if (err != nil) != tt.wantErr {
t.Errorf("Macro.Get() error = %v, wantErr %v", err, tt.wantErr)
}

if err != nil && err.Error() != tt.errMsg {
t.Errorf("Macro.Get() error message = %v, want %v", err.Error(), tt.errMsg)
}

if cmd != tt.wantCmd {
t.Errorf("Macro.Get() cmd = %v, want %v", cmd, tt.wantCmd)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/edit/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func TestContent_MovePositionLeft(t *testing.T) {
if actual != tt.expected {
t.Errorf("expected %q, but got %q", tt.expected, actual)
}

if tt.content.pos != tt.expectedPos {
t.Errorf("expected position %d, but got %d", tt.expectedPos, tt.content.pos)
}
Expand Down Expand Up @@ -244,6 +245,7 @@ func TestContent_MovePositionRight(t *testing.T) {
if actual != tt.expected {
t.Errorf("expected %q, but got %q", tt.expected, actual)
}

if tt.content.pos != tt.expectedPos {
t.Errorf("expected position %d, but got %d", tt.expectedPos, tt.content.pos)
}
Expand Down Expand Up @@ -487,6 +489,7 @@ func TestContent_MoveToEnd(t *testing.T) {
if actual != tc.expected {
t.Errorf("expected %q but got %q", tc.expected, actual)
}

if tc.content.pos != len(tc.content.text) {
t.Errorf("expected cursor to be at the end of the text")
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/ws/ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ func NewWS(wsURL string, opts Options) (*Connection, error) {

// This option could be useful for testing and development purposes.
// Default value is false.
// #nosec G402
tlsConfig := &tls.Config{
InsecureSkipVerify: opts.SkipSSLVerification,
InsecureSkipVerify: opts.SkipSSLVerification, // #nosec G402 - skip SSL verification
}
cfg.TlsConfig = tlsConfig

Expand Down
8 changes: 8 additions & 0 deletions pkg/ws/ws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import (
func TestNewWS(t *testing.T) {
server := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {
var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand Down Expand Up @@ -61,8 +63,10 @@ func TestNewWSFailToConnect(t *testing.T) {
func TestNewWSDisconnect(t *testing.T) {
server := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {
var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand Down Expand Up @@ -98,8 +102,10 @@ func TestNewWSWithHeaders(t *testing.T) {
}

var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand All @@ -117,8 +123,10 @@ func TestNewWSWithHeaders(t *testing.T) {
func TestNewWSWithInvalidHeaders(t *testing.T) {
server := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {
var msg string

_ = websocket.Message.Receive(ws, &msg) // wait for request
_, _ = ws.Write([]byte(msg))

time.Sleep(time.Second) // to keep the connection open
}))
defer server.Close()
Expand Down

0 comments on commit 378499a

Please sign in to comment.