Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
avivklas committed Jun 24, 2019
1 parent 10f5f32 commit e80e96b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions protocol/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (h *Handshake) Init() (res Message, err error) {
}

// read the initial connection startup message
res, err = h.readRawMessage()
res, err = h.Read()
if err != nil {
return nil, err
}
Expand All @@ -60,7 +60,7 @@ func (h *Handshake) Init() (res Message, err error) {
return nil, err
}

res, err = h.readRawMessage()
res, err = h.Read()
if err != nil {
return nil, err
}
Expand All @@ -77,7 +77,6 @@ func (h *Handshake) Init() (res Message, err error) {
h.passed = true

return res, nil

}

func (h *Handshake) readTypedMessage() (Message, error) {
Expand Down
4 changes: 2 additions & 2 deletions protocol/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
)

func TestHandshake_Do(t *testing.T) {
func TestHandshake_Init(t *testing.T) {
t.Run("supported protocol version", func(t *testing.T) {
buf := bytes.Buffer{}
comm := bufio.NewReadWriter(bufio.NewReader(&buf), bufio.NewWriter(&buf))
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestHandshake_Do(t *testing.T) {
require.Error(t, err, "expected error of unsupported version. got none")
})

t.Run("do twice returns an error", func(t *testing.T) {
t.Run("call init twice returns an error", func(t *testing.T) {
buf := bytes.Buffer{}
comm := bufio.NewReadWriter(bufio.NewReader(&buf), bufio.NewWriter(&buf))
handshake := NewHandshake(comm)
Expand Down
2 changes: 1 addition & 1 deletion protocol/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Transport struct {
}

func (t *Transport) beginTransaction() {
t.transaction = &transaction{transport: t, in: []pgproto3.FrontendMessage{}, out: []Message{}}
t.transaction = &transaction{transport: t}
}

func (t *Transport) endTransaction() (err error) {
Expand Down
1 change: 0 additions & 1 deletion session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,5 @@ func TestSession_startUp(t *testing.T) {
_ = s.startUp()
require.NoError(t, err)
require.Equal(t, true, canceled)

})
}

0 comments on commit e80e96b

Please sign in to comment.