Skip to content

Commit 6f843e8

Browse files
authored
fix: improvements in tests, build, dependencies, docs and network options (#42)
1 parent ad3776e commit 6f843e8

File tree

254 files changed

+8564
-3771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+8564
-3771
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
target
22
build
3+
cmake-build-debug
4+
cmake-build-release
35
.vs
46
.vscode
7+
.idea
58
questdb-rs/Cargo.lock
69
include/questdb/ilp/line_sender.gen.h
710
cython/questdb/ilp/line_sender.pxd

CMakeLists.txt

Lines changed: 83 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ set(CPACK_PROJECT_NAME ${PROJECT_NAME})
55
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
66
include(CPack)
77

8-
include(CTest)
9-
enable_testing()
8+
option(QUESTDB_TESTS_AND_EXAMPLES "Build test and example targets" OFF)
9+
10+
if (QUESTDB_TESTS_AND_EXAMPLES)
11+
include(CTest)
12+
enable_testing()
13+
endif()
1014

1115
set(CMAKE_C_STANDARD 11)
1216
set(CMAKE_C_STANDARD_REQUIRED ON)
@@ -25,8 +29,7 @@ option(
2529
# Imports `questdb_client` target.
2630
add_subdirectory(corrosion)
2731
corrosion_import_crate(
28-
MANIFEST_PATH questdb-rs-ffi/Cargo.toml
29-
LINK_AS C)
32+
MANIFEST_PATH questdb-rs-ffi/Cargo.toml)
3033
target_include_directories(
3134
questdb_client INTERFACE
3235
${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -37,7 +40,10 @@ if(WIN32)
3740
DEFINE_SYMBOL "LINESENDER_DYN_LIB")
3841
target_link_libraries(
3942
questdb_client-shared
40-
INTERFACE wsock32 ws2_32)
43+
INTERFACE wsock32 ws2_32 ntdll)
44+
target_link_libraries(
45+
questdb_client-static
46+
INTERFACE wsock32 ws2_32 ntdll)
4147
endif(WIN32)
4248
if(APPLE)
4349
target_link_libraries(
@@ -77,77 +83,79 @@ function(compile_example TARGET_NAME)
7783
questdb_client)
7884
endfunction()
7985

80-
compile_example(
81-
line_sender_c_example
82-
examples/line_sender_c_example.c)
83-
compile_example(
84-
line_sender_c_example_auth
85-
examples/line_sender_c_example_auth.c)
86-
compile_example(
87-
line_sender_c_example_tls_ca
88-
examples/line_sender_c_example_tls_ca.c)
89-
compile_example(
90-
line_sender_c_example_auth_tls
91-
examples/line_sender_c_example_auth_tls.c)
92-
compile_example(
93-
line_sender_cpp_example
94-
examples/line_sender_cpp_example.cpp)
95-
compile_example(
96-
line_sender_cpp_example_auth
97-
examples/line_sender_cpp_example_auth.cpp)
98-
compile_example(
99-
line_sender_cpp_example_tls_ca
100-
examples/line_sender_cpp_example_tls_ca.cpp)
101-
compile_example(
102-
line_sender_cpp_example_auth_tls
103-
examples/line_sender_cpp_example_auth_tls.cpp)
104-
105-
# Include Rust tests as part of the tests run
106-
add_test(
107-
NAME rust_tests
108-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/questdb-rs
109-
COMMAND cargo test --features insecure-skip-verify -- --nocapture)
86+
if (QUESTDB_TESTS_AND_EXAMPLES)
87+
compile_example(
88+
line_sender_c_example
89+
examples/line_sender_c_example.c)
90+
compile_example(
91+
line_sender_c_example_auth
92+
examples/line_sender_c_example_auth.c)
93+
compile_example(
94+
line_sender_c_example_tls_ca
95+
examples/line_sender_c_example_tls_ca.c)
96+
compile_example(
97+
line_sender_c_example_auth_tls
98+
examples/line_sender_c_example_auth_tls.c)
99+
compile_example(
100+
line_sender_cpp_example
101+
examples/line_sender_cpp_example.cpp)
102+
compile_example(
103+
line_sender_cpp_example_auth
104+
examples/line_sender_cpp_example_auth.cpp)
105+
compile_example(
106+
line_sender_cpp_example_tls_ca
107+
examples/line_sender_cpp_example_tls_ca.cpp)
108+
compile_example(
109+
line_sender_cpp_example_auth_tls
110+
examples/line_sender_cpp_example_auth_tls.cpp)
110111

111-
# Unit test binaries.
112-
function(compile_test TARGET_NAME)
113-
list(POP_FRONT ARGV) # compile_test
114-
add_executable(
115-
${TARGET_NAME}
116-
${ARGV})
117-
target_link_libraries(
118-
${TARGET_NAME}
119-
questdb_client)
120-
target_include_directories(
121-
${TARGET_NAME}
122-
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
123-
set_compile_flags(${TARGET_NAME})
112+
# Include Rust tests as part of the tests run
124113
add_test(
125-
NAME ${TARGET_NAME}
126-
COMMAND ${TARGET_NAME})
127-
endfunction()
114+
NAME rust_tests
115+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/questdb-rs
116+
COMMAND cargo test --features insecure-skip-verify -- --nocapture)
128117

129-
compile_test(
130-
test_line_sender
131-
cpp_test/mock_server.cpp
132-
cpp_test/test_line_sender.cpp)
118+
# Unit test binaries.
119+
function(compile_test TARGET_NAME)
120+
list(POP_FRONT ARGV) # compile_test
121+
add_executable(
122+
${TARGET_NAME}
123+
${ARGV})
124+
target_link_libraries(
125+
${TARGET_NAME}
126+
questdb_client)
127+
target_include_directories(
128+
${TARGET_NAME}
129+
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
130+
set_compile_flags(${TARGET_NAME})
131+
add_test(
132+
NAME ${TARGET_NAME}
133+
COMMAND ${TARGET_NAME})
134+
endfunction()
133135

134-
# System testing Python3 script.
135-
# This will download the latest QuestDB instance from Github,
136-
# thus will also require a Java 11 installation to run the tests.
137-
option(QUESTDB_SYSTEM_TESTING "Run system tests" OFF)
138-
if(QUESTDB_SYSTEM_TESTING)
139-
find_package(
140-
Python3
141-
REQUIRED
142-
COMPONENTS Interpreter)
143-
find_package(
144-
Java
145-
11
146-
REQUIRED)
147-
add_test(
148-
NAME system_test
149-
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/system_test/test.py run -v)
150-
set_tests_properties(
151-
system_test PROPERTIES
152-
ENVIRONMENT BUILD_DIR_PATH=${CMAKE_BINARY_DIR})
153-
endif(QUESTDB_SYSTEM_TESTING)
136+
compile_test(
137+
test_line_sender
138+
cpp_test/mock_server.cpp
139+
cpp_test/test_line_sender.cpp)
140+
141+
# System testing Python3 script.
142+
# This will download the latest QuestDB instance from Github,
143+
# thus will also require a Java 11 installation to run the tests.
144+
option(QUESTDB_SYSTEM_TESTING "Run system tests" OFF)
145+
if(QUESTDB_SYSTEM_TESTING)
146+
find_package(
147+
Python3
148+
REQUIRED
149+
COMPONENTS Interpreter)
150+
find_package(
151+
Java
152+
11
153+
REQUIRED)
154+
add_test(
155+
NAME system_test
156+
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/system_test/test.py run -v)
157+
set_tests_properties(
158+
system_test PROPERTIES
159+
ENVIRONMENT BUILD_DIR_PATH=${CMAKE_BINARY_DIR})
160+
endif(QUESTDB_SYSTEM_TESTING)
161+
endif()

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ To get started, read the language-specific guides.
6666

6767
* [Data quality and threading considerations](doc/CONSIDERATIONS.md)
6868
* [Authentication and TLS encryption](doc/SECURITY.md)
69-
* [Troubleshooting](doc/TROUBLESHOOTING.md)
7069

7170
## Community
7271

cbindgen.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ header = """/*******************************************************************
88
* \\__\\_\\\\__,_|\\___||___/\\__|____/|____/
99
*
1010
* Copyright (c) 2014-2019 Appsicle
11-
* Copyright (c) 2019-2022 QuestDB
11+
* Copyright (c) 2019-2023 QuestDB
1212
*
1313
* Licensed under the Apache License, Version 2.0 (the "License");
1414
* you may not use this file except in compliance with the License.

ci/run_all_tests.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ def main():
3838
test_line_sender_path = next(iter(
3939
build_dir.glob(f'**/test_line_sender{exe_suffix}')))
4040
system_test_path = pathlib.Path('system_test') / 'test.py'
41-
qdb_v = '6.4.3' # The version of QuestDB we'll test against.
41+
qdb_v = '7.3.2' # The version of QuestDB we'll test against.
4242

43-
run_cmd('cargo', 'test',
44-
'--features', 'insecure-skip-verify',
45-
'--', '--nocapture',
46-
cwd='questdb-rs')
43+
run_cmd('cargo', 'test', '--all-features', '--', '--nocapture', cwd='questdb-rs')
4744
run_cmd(str(test_line_sender_path))
4845
run_cmd('python3', str(system_test_path), 'run', '--versions', qdb_v, '-v')
4946

ci/run_tests_pipeline.yaml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ stages:
6767
displayName: "Update and set Rust toolchain"
6868
- script: |
6969
cd questdb-rs
70-
cargo build --example basic
71-
cargo build --example auth
72-
cargo build --example auth_tls
70+
cargo build --example basic --features=chrono_timestamp
71+
cargo build --example auth --features=chrono_timestamp
72+
cargo build --example auth_tls --features=chrono_timestamp
7373
displayName: Build Rust examples.
74-
- script: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
74+
- script: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DQUESTDB_TESTS_AND_EXAMPLES=ON
7575
env:
7676
JAVA_HOME: $(JAVA_HOME_11_X64)
7777
displayName: "Build Makefile with CMake"
@@ -96,4 +96,41 @@ stages:
9696
inputs:
9797
pathToPublish: ./build
9898
displayName: "Publish build directory"
99-
condition: eq(variables['BUILD_WITH_MINGW'], '1')
99+
condition: eq(variables['BUILD_WITH_MINGW'], '1')
100+
- job: CargoFmtAndClippy
101+
displayName: "cargo fmt and clippy"
102+
pool:
103+
vmImage: 'ubuntu-latest'
104+
timeoutInMinutes: 10
105+
steps:
106+
- checkout: self
107+
- script: |
108+
rustup component add clippy
109+
rustup component add rustfmt
110+
displayName: "Install clippy and rustfmt"
111+
- script: |
112+
cd questdb-rs
113+
cargo fmt --all -- --check
114+
displayName: "questdb-rs: fmt"
115+
- script: |
116+
cd questdb-rs
117+
cargo clippy --all-targets --all-features -- -D warnings
118+
displayName: "questdb-rs: clippy"
119+
- script: |
120+
cd questdb-rs-ffi
121+
cargo fmt --all -- --check
122+
displayName: "questdb-rs-ffi: fmt"
123+
- script: |
124+
cd questdb-rs-ffi
125+
cargo clippy --all-targets --all-features -- -D warnings
126+
displayName: "questdb-rs-ffi: clippy"
127+
- script: |
128+
cd system_test
129+
cd tls_proxy
130+
cargo fmt --all -- --check
131+
displayName: "tls_proxy: fmt"
132+
- script: |
133+
cd system_test
134+
cd tls_proxy
135+
cargo clippy --all-targets --all-features -- -D warnings
136+
displayName: "tls_proxy: clippy"

corrosion/.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: ["jschwe"]
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
assignees:
6+
- jschwe
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Thanks for taking the time to fill out this bug report!
12+
- type: textarea
13+
attributes:
14+
label: Current Behavior
15+
description: A concise description of what you're experiencing.
16+
validations:
17+
required: false
18+
- type: textarea
19+
attributes:
20+
label: Expected Behavior
21+
description: A concise description of what you expected to happen.
22+
validations:
23+
required: false
24+
- type: textarea
25+
attributes:
26+
label: Steps To Reproduce
27+
description: Steps to reproduce the behavior.
28+
placeholder: |
29+
1. In this environment...
30+
2. With this config...
31+
3. Run '...'
32+
4. See error...
33+
validations:
34+
required: false
35+
- type: textarea
36+
attributes:
37+
label: Environment
38+
description: |
39+
examples:
40+
- **OS**: Ubuntu 22.04
41+
- **CMake**: 3.22.0
42+
- **CMake Generator**: Ninja 1.11
43+
value: |
44+
- OS:
45+
- CMake:
46+
- CMake Generator:
47+
render: markdown
48+
validations:
49+
required: false
50+
- type: textarea
51+
attributes:
52+
label: CMake configure log with Debug log-level
53+
description: |
54+
Output when configuring with `cmake -S<source_dir> -B<build_dir> --log-level=DEBUG <your_other_options>`:
55+
<details><summary>CMake configure log</summary>
56+
<p>
57+
58+
```
59+
<log>
60+
```
61+
62+
</p>
63+
</details>
64+
validations:
65+
required: false
66+
- type: textarea
67+
attributes:
68+
label: CMake Build step log
69+
description: |
70+
Output when building with `cmake --build <build_dir> --verbose`:
71+
<details><summary>CMake build log</summary>
72+
<p>
73+
74+
```
75+
<log>
76+
```
77+
78+
</p>
79+
</details>
80+
validations:
81+
required: false

0 commit comments

Comments
 (0)