Skip to content

Commit

Permalink
test latest clickhouse by default, but include Plausible-specific ver…
Browse files Browse the repository at this point in the history
…sion in the matrix
  • Loading branch information
ruslandoga committed Jan 12, 2024
1 parent 1212a1a commit 9eb884e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,24 @@ jobs:
matrix:
elixir: ["1.14", "1.15", "1.16"]
otp: ["25", "26"]
clickhouse: ["23.3.7.5", "latest"]
clickhouse: ["latest"]
timezone: ["UTC"]
include:
- elixir: "1.16"
otp: "26"
clickhouse: "23.3.7.5"
clickhouse: "latest"
timezone: "Europe/Berlin"
# Plausible
# - https://github.com/plausible/analytics/blob/master/.tool-versions
# - https://github.com/plausible/analytics/blob/master/.github/workflows/elixir.yml
- elixir: "1.16.0"
otp: "26.2.1"
clickhouse: "23.3.7.5"
timezone: "UTC"

services:
clickhouse:
image: clickhouse/clickhouse-server:${{ matrix.clickhouse }}-alpine
image: clickhouse/clickhouse-server:${{ matrix.clickhouse }}
ports:
- 8123:8123
env:
Expand Down
5 changes: 3 additions & 2 deletions test/ch/connection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,9 @@ defmodule Ch.ConnectionTest do
assert {:error, %Ch.Error{code: 81} = error} =
Ch.query(conn, "select 1 + 1", _params = [], database: "no-db")

assert Exception.message(error) =~
"Code: 81. DB::Exception: Database `no-db` doesn't exist. (UNKNOWN_DATABASE)"
assert Exception.message(error) =~ "Code: 81."
assert Exception.message(error) =~ "`no-db`"
assert Exception.message(error) =~ "(UNKNOWN_DATABASE)"
end

test "can provide custom database", %{conn: conn} do
Expand Down
11 changes: 5 additions & 6 deletions test/ch/stream_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ defmodule Ch.StreamTest do
test "emits %Ch.Result{}", %{conn: conn} do
count = 1_000_000

assert [%Result{command: :select, data: header} | rest] =
assert [%Result{command: :select, data: header} | _rest] =
results =
DBConnection.run(conn, fn conn ->
conn
|> Ch.stream("select * from numbers({count:UInt64})", %{"count" => 1_000_000})
|> Enum.into([])
end)

assert header == [<<1, 6, "number", 6, "UInt64">>]
assert [<<1, 6, "number", 6, "UInt64">> | _] = header

decoded =
Enum.flat_map(rest, fn %Result{data: data} ->
data |> IO.iodata_to_binary() |> RowBinary.decode_rows([:u64])
end)
decoded = results |> Enum.map(& &1.data) |> IO.iodata_to_binary() |> RowBinary.decode_rows()

assert [[0], [1], [2] | _] = decoded
assert length(decoded) == count
end

Expand Down

0 comments on commit 9eb884e

Please sign in to comment.