Skip to content

Commit 982ded0

Browse files
Tests refactors (#115)
* python scripts now creates new logs each time * Moved a thing * 2 more scenarios * storage_db * sqlite free invalid pointer changes * error msg and changelog * 104,19 and workflow * added pr builds * compiler * iter * added curl * added submodules * update submodules * version * ubuntu 20.04 * cnt on ett * platforms yml * fixed windows * bnmae change * tests --------- Co-authored-by: ArtursK <[email protected]>
1 parent 0d34011 commit 982ded0

File tree

10 files changed

+740
-544
lines changed

10 files changed

+740
-544
lines changed

.github/workflows/tests.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [master, staging]
6+
pull_request:
7+
branches: [master, staging]
8+
9+
jobs:
10+
doctests:
11+
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 120
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os:
17+
- ubuntu-20.04
18+
- macos-11.0
19+
- windows-2019
20+
21+
include:
22+
- os: windows-2019
23+
cmake-generator: -G "Visual Studio 16 2019" -A x64
24+
cmake-install: "choco install -y cmake"
25+
dependencies: |
26+
choco install -y openssl
27+
choco install -y visualstudio2017-workload-vctools
28+
choco upgrade -y visualstudio2017-workload-vctools
29+
make: msbuild countly-tests.vcxproj -t:rebuild -verbosity:diag -property:Configuration=Release && .\Release\countly-tests.exe
30+
- os: macos-11.0
31+
cmake-install: "brew install cmake"
32+
dependencies: "brew install openssl"
33+
make: make ./countly-tests && ./countly-tests
34+
- os: ubuntu-20.04
35+
cmake-install: "sudo apt-get update && sudo apt-get install -y cmake"
36+
dependencies: "sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev"
37+
make: make ./countly-tests && ./countly-tests
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
with:
43+
submodules: "recursive"
44+
45+
- name: Update submodules
46+
run: git submodule update --init --recursive
47+
48+
- name: Install CMake
49+
run: ${{ matrix.cmake-install }}
50+
51+
- name: Install dependencies
52+
run: ${{ matrix.dependencies }}
53+
54+
- name: Set up MSVC
55+
if: matrix.os == 'windows-2019'
56+
uses: microsoft/setup-msbuild@v1
57+
58+
- name: Build and run tests
59+
run: |
60+
cmake -DCOUNTLY_BUILD_TESTS=1 -B build . ${{ matrix.cmake-generator }}
61+
cd build
62+
${{ matrix.make }}

CHANGELOG.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
22.09.0
1+
## 22.09.1
2+
* Mitigated a problem that caused invalid pointer error if the database path was set wrong
3+
4+
## 22.09.0
25
* ! Minor breaking change ! SDK configuration now can't be changed after initialization/start
36
* Added a persistent requests queue when building the SDK with the 'COUNTLY_USE_SQLITE' flag
47
* Fixed a bug where view's name was being overriden by segmentation provided.
58

6-
22.06.4
9+
## 22.06.4
710
* Fixed a bug where the SDK 'mutex' was being locked twice when built with the 'COUNTLY_USE_SQLITE' flag.
811

9-
22.06.3
12+
## 22.06.3
1013
* Fixed a bug where empty metrics were sent with session begin request.
1114

12-
22.06.2
15+
## 22.06.2
1316
* Fixed a bug where metrics were not sent with session begin request.
1417

15-
22.06.1
18+
## 22.06.1
1619
* !! Major breaking change !! We are removing the 'LogLevel' enum out of the 'Countly' class which will change how that enum can be referenced. 'Countly::LogLevel' will not work, you will have to use 'cly::LogLevel' instead.
1720
* Added functionality to record crash.
1821
* Added ability to record breadcrumbs for crash recording.
1922

20-
22.06.0
23+
## 22.06.0
2124
* !! Major breaking change !! We are adding the 'cly' namespace on 'Countly' class which will change how that class can be referenced. 'Countly::' will not work, you will have to use 'cly::Countly::' instead.
2225
* !! Major breaking change !! We are extracting the 'Event' class out of the 'Countly' class which will change how that class can be referenced. 'Countly::Event' will not work, you will have to use 'cly::Event' instead.
2326
* !! Major breaking change !! Increased the compiler version required to compile the SDK. It's increased from version C++11 to C++14.
2427
* Making network requests has been reworked. They will now be sent on a separate thread. Requests will also be added in an internal queue and will be sent one at a time.
2528
* When making network requests, the SDK will now unlock it's mutex.
2629
* Fixed a bug that caused an exception on windows when encoding data that contains special characters.
2730

28-
22.02.0
31+
## 22.02.0
2932
* Added 10-second time-outs for all windows HTTP transactions.
3033
* Added ability to record views.
3134

32-
21.11.3
35+
## 21.11.3
3336
* Added functionality to set custom SHA256.
3437

35-
21.11.2
38+
## 21.11.2
3639
* Fixed a bug that occurred after trying to erase events from the SQLite database when there were none.
3740
* Fixed a bug with the checksum calculation.
3841

39-
21.11.1
42+
## 21.11.1
4043
* !! Major breaking change !! Fixed a bug that triggered when providing segmentation to the "RecordEvent" call. Previously, by mistake, every segmentation value was parsed as a JSON and threw an exception when it wasn't a valid JSON string.
4144
Now this will not be the case and every String value can be provided. This is marked as a "major breaking change" in case some integrations were adding workarounds to this issue.
4245
* ! Minor breaking change ! Default automatic session update duration changed to 60 seconds.
@@ -52,7 +55,7 @@ Now this will not be the case and every String value can be provided. This is ma
5255
* Fixed issues with location requests.
5356
* Deprecated old location calls and introduced a new location call
5457

55-
21.11.0
58+
## 21.11.0
5659
* Fixed session duration issue.
5760
* Added functionality to report event duration manually.
5861
* 'startOnCloud' in 'Countly' is deprecated and this is going to be removed in the future.

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ if(COUNTLY_BUILD_TESTS)
108108
${CMAKE_CURRENT_SOURCE_DIR}/tests/views.cpp
109109
${CMAKE_CURRENT_SOURCE_DIR}/tests/session.cpp
110110
${CMAKE_CURRENT_SOURCE_DIR}/tests/storage.cpp
111+
${CMAKE_CURRENT_SOURCE_DIR}/tests/storage_db.cpp
111112
${CMAKE_CURRENT_SOURCE_DIR}/tests/event.cpp
112113
${CMAKE_CURRENT_SOURCE_DIR}/tests/crash.cpp
113114
${CMAKE_CURRENT_SOURCE_DIR}/tests/request.cpp
114115
${CMAKE_CURRENT_SOURCE_DIR}/tests/config.cpp)
115-
116+
117+
target_compile_options(countly-tests PRIVATE -g)
116118
target_compile_definitions(countly-tests PRIVATE COUNTLY_BUILD_TESTS)
117119
if(COUNTLY_USE_SQLITE)
118120
message("Compiling definitions for sqlite")

include/countly.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Countly : public cly::CountlyDelegates {
3333
public:
3434
Countly();
3535

36-
~Countly();
36+
virtual ~Countly();
3737

3838
// Returns the singleton instance of Countly
3939
static Countly &getInstance();
@@ -131,8 +131,6 @@ class Countly : public cly::CountlyDelegates {
131131
void SetPath(const std::string &path) {
132132
#ifdef COUNTLY_USE_SQLITE
133133
setDatabasePath(path);
134-
#elif defined _WIN32
135-
UNREFERENCED_PARAMETER(path);
136134
#endif
137135
}
138136

python_build_script.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import itertools
55

66
# Set up logging
7-
logging.basicConfig(filename='test_results.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s')
7+
log_filename = 'test_results_{}.log'.format(datetime.datetime.now().strftime('%Y%m%d_%H%M%S'))
8+
logging.basicConfig(filename=log_filename, level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s')
9+
810
# List all combinations of COUNTLY_USE_CUSTOM_SHA256 and COUNTLY_USE_SQLITE
911
options = [(0, 0), (0, 1), (1, 0), (1, 1)]
1012

0 commit comments

Comments
 (0)