forked from ansible-collections/community.clickhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clickhouse_client: add testing for querying more data types
- Loading branch information
1 parent
71d49e2
commit 373fca6
Showing
3 changed files
with
79 additions
and
68 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
tests/integration/targets/clickhouse_client/tasks/data_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
- name: The system.users table contain UUID value | ||
register: result | ||
community.clickhouse.clickhouse_client: | ||
execute: SELECT id FROM system.users LIMIT 1 | ||
|
||
- name: Check the result | ||
ansible.builtin.assert: | ||
that: | ||
- result.result[0] != [] | ||
|
||
|
||
- name: Create table with Decimal and DateTime columns | ||
community.clickhouse.clickhouse_client: | ||
execute: CREATE TABLE decimal_datetime (x Decimal(12,4), y DateTime) ENGINE = Memory | ||
|
||
- name: Insert Decimal and DateTime | ||
community.clickhouse.clickhouse_client: | ||
execute: "INSERT INTO decimal_datetime VALUES ('4.01', '2019-01-01 00:00:00')" | ||
|
||
- name: Select Decimal and DateTime | ||
register: result | ||
community.clickhouse.clickhouse_client: | ||
execute: "SELECT * FROM decimal_datetime" | ||
|
||
- name: Check the ret vals | ||
ansible.builtin.assert: | ||
that: | ||
- result.result == [[4.01, '2019-01-01T00:00:00']] | ||
|
||
|
||
- name: Create table with Map column | ||
community.clickhouse.clickhouse_client: | ||
execute: CREATE TABLE map (x Map(String, UInt64)) ENGINE = Memory | ||
|
||
- name: Insert Map | ||
community.clickhouse.clickhouse_client: | ||
execute: "INSERT INTO map VALUES ({'a': 1, 'b': 2})" | ||
|
||
- name: Select Map | ||
register: result | ||
community.clickhouse.clickhouse_client: | ||
execute: "SELECT * FROM map" | ||
|
||
- name: Check the ret vals | ||
ansible.builtin.assert: | ||
that: | ||
- result.result[0][0]['a'] == 1 | ||
|
||
# Test version dependent features | ||
- name: Get server version | ||
register: srv | ||
community.clickhouse.clickhouse_info: | ||
limit: version | ||
|
||
|
||
- name: Test Point column | ||
when: srv['version']['year'] >= 23 | ||
block: | ||
|
||
- name: Create table with Point column | ||
community.clickhouse.clickhouse_client: | ||
execute: CREATE TABLE geo_point (p Point) ENGINE = Memory | ||
|
||
- name: Insert Point | ||
community.clickhouse.clickhouse_client: | ||
execute: "INSERT INTO geo_point VALUES ((10, 10))" | ||
|
||
- name: Select Point | ||
register: result | ||
community.clickhouse.clickhouse_client: | ||
execute: "SELECT * FROM geo_point" | ||
|
||
- name: Check the ret vals | ||
ansible.builtin.assert: | ||
that: | ||
- result.result == [[[10, 10]]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters