Skip to content

Commit

Permalink
fix(test): fix units tests
Browse files Browse the repository at this point in the history
- fix unit tests
- upgrade golangci-lint version to 1.56.2 in Makefile
- fix ParseTypeDesc documentation
  • Loading branch information
evrentan committed Feb 24, 2024
1 parent 8997ea9 commit 715802f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SHELL := /bin/bash

init:
GO111MODULE=on go mod vendor
go install github.com/golangci/golangci-lint/...@v1.35.2
go install github.com/golangci/golangci-lint/...@v1.56.2

up_docker_server: stop_docker_server
docker run --rm=true -p 8123:8123 -p 9000:9000 --name dbr-clickhouse-server -d clickhouse/clickhouse-server:latest;
Expand Down
2 changes: 1 addition & 1 deletion conn_go18_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *connSuite) TestPassRequestQueryParamsFromContext() {
ctx = context.WithValue(context.Background(), RequestQueryParams, map[string]string{
"no_cache": "1",
})
s.EqualError(s.conn.PingContext(ctx), "Code: 115, Message: Unknown setting no_cache")
s.EqualError(s.conn.PingContext(ctx), "Code: 115, Message: Setting no_cache is neither a builtin setting nor started with the prefix 'SQL_' registered for user-defined settings")
}

func (s *connSuite) TestColumnTypes() {
Expand Down
6 changes: 3 additions & 3 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ func (s *connSuite) TestServerError() {
_, err := s.conn.Query("SELECT 1 FROM '???'")
srvErr, ok := err.(*Error)
s.Require().True(ok, err.Error())
s.Equal(62, srvErr.Code)
s.Contains(srvErr.Message, "Syntax error:")
s.Contains(srvErr.Error(), "Code: 62, Message: Syntax error:")
s.Equal(60, srvErr.Code)
s.Contains(srvErr.Message, "Table default")
s.Contains(srvErr.Error(), "Code: 60, Message: Table default")
}

func (s *connSuite) TestServerKillQuery() {
Expand Down
34 changes: 19 additions & 15 deletions typeparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,25 @@ func parseTypeDesc(tokens []*token) (*TypeDesc, []*token, error) {
}
}

// ParseTypeDesc parses the type description that ClickHouse provides.
//
// The grammar is quite simple:
// desc
// name
// name()
// name(args)
// args
// desc
// desc, args
//
// Examples:
// String
// Nullable(Nothing)
// Array(Tuple(Tuple(String, String), Tuple(String, UInt64)))
/*
ParseTypeDesc parses the type description that ClickHouse provides.
The grammar is quite simple:
desc
name
name()
name(args)
args
desc
desc, args
Examples:
String
Nullable(Nothing)
Array(Tuple(Tuple(String, String), Tuple(String, UInt64)))
*/
func ParseTypeDesc(s string) (*TypeDesc, error) {
tokens, err := tokenizeString(s)
if err != nil {
Expand Down

0 comments on commit 715802f

Please sign in to comment.