-
Notifications
You must be signed in to change notification settings - Fork 37
Update c driver tests to 3.x and enable deployment #795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e6c5720
d009be4
fc88b50
5f4f42b
9628268
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ commands: | |
type: string | ||
steps: | ||
- run: | | ||
brew install [email protected] | ||
brew install --skip-post-install [email protected] && brew postinstall [email protected] | ||
curl -OL "https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-darwin-<<parameters.bazel-arch>>" | ||
sudo mv "bazelisk-darwin-<<parameters.bazel-arch>>" /usr/local/bin/bazel | ||
chmod a+x /usr/local/bin/bazel | ||
|
@@ -531,7 +531,7 @@ jobs: | |
|
||
- deploy-maven-jni-snapshot-unix | ||
|
||
# - deploy-clib-snapshot-unix | ||
- deploy-clib-snapshot-unix | ||
# - test-clib-assembly-linux: | ||
# target-arch: arm64 | ||
|
||
|
@@ -553,7 +553,7 @@ jobs: | |
|
||
- deploy-maven-jni-snapshot-unix | ||
|
||
# - deploy-clib-snapshot-unix | ||
- deploy-clib-snapshot-unix | ||
# - test-clib-assembly-linux: | ||
# target-arch: x86_64 | ||
|
||
|
@@ -577,7 +577,7 @@ jobs: | |
|
||
# - run: brew install cmake | ||
|
||
# - deploy-clib-snapshot-unix | ||
- deploy-clib-snapshot-unix | ||
# - test-clib-assembly-mac: | ||
# target-arch: arm64 | ||
|
||
|
@@ -601,7 +601,7 @@ jobs: | |
|
||
# - run: brew install cmake | ||
|
||
# - deploy-clib-snapshot-unix | ||
- deploy-clib-snapshot-unix | ||
# - test-clib-assembly-mac: | ||
# target-arch: x86_64 | ||
|
||
|
@@ -622,8 +622,8 @@ jobs: | |
|
||
- run: .circleci\windows\java\deploy_snapshot.bat | ||
|
||
# - run: .circleci\windows\clib\deploy_snapshot.bat | ||
# - run: .circleci\windows\clib\test_assembly.bat | ||
- run: .circleci\windows\clib\deploy_snapshot.bat | ||
- run: .circleci\windows\clib\test_assembly.bat | ||
|
||
# - run: .circleci\windows\cpp\deploy_snapshot.bat | ||
# - run: .circleci\windows\cpp\test_assembly.bat | ||
|
@@ -730,7 +730,7 @@ jobs: | |
bazel-arch: arm64 | ||
- deploy-pip-release-unix | ||
- deploy-maven-jni-release-unix | ||
# - deploy-clib-release-unix | ||
- deploy-clib-release-unix | ||
# - deploy-cpp-release-unix | ||
|
||
# - install-libicu-linux | ||
|
@@ -744,7 +744,7 @@ jobs: | |
bazel-arch: amd64 | ||
- deploy-pip-release-unix | ||
- deploy-maven-jni-release-unix | ||
# - deploy-clib-release-unix | ||
- deploy-clib-release-unix | ||
# - deploy-cpp-release-unix | ||
|
||
# - install-libicu-linux | ||
|
@@ -758,7 +758,7 @@ jobs: | |
bazel-arch: arm64 | ||
- deploy-pip-release-unix | ||
- deploy-maven-jni-release-unix | ||
# - deploy-clib-release-unix | ||
- deploy-clib-release-unix | ||
# - deploy-cpp-release-unix | ||
# - deploy-dotnet-runtime-release-unix | ||
|
||
|
@@ -771,7 +771,7 @@ jobs: | |
bazel-arch: amd64 | ||
- deploy-pip-release-unix | ||
- deploy-maven-jni-release-unix | ||
# - deploy-clib-release-unix | ||
- deploy-clib-release-unix | ||
# - deploy-cpp-release-unix | ||
# - deploy-dotnet-runtime-release-unix | ||
|
||
|
@@ -783,7 +783,7 @@ jobs: | |
- run: .circleci\windows\prepare.bat | ||
- run: .circleci\windows\python\deploy_release.bat | ||
- run: .circleci\windows\java\deploy_release.bat | ||
# - run: .circleci\windows\clib\deploy_release.bat | ||
- run: .circleci\windows\clib\deploy_release.bat | ||
# - run: .circleci\windows\cpp\deploy_release.bat | ||
# - run: .circleci\windows\csharp\deploy_release.bat | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
#include <typedb_driver.h> | ||
|
||
const char* TYPEDB_CORE_ADDRESS = "127.0.0.1:1729"; | ||
const char* TYPEDB_CORE_USERNAME = "admin"; | ||
const char* TYPEDB_CORE_PASSWORD = "password"; | ||
const char* DRIVER_LANG = "c"; | ||
|
||
|
||
|
@@ -40,34 +42,42 @@ bool check_error_may_print(const char* filename, int lineno) { | |
} | ||
|
||
#define FAILED() check_error_may_print(__FILE__, __LINE__) | ||
TypeDBDriver* driver_open_for_tests(const char* address, const char* username, const char* password) { | ||
DriverOptions* options = NULL; | ||
Credentials* creds = credentials_new(username, password); | ||
if (check_error_may_print(__FILE__, __LINE__)) goto cleanup; | ||
options = driver_options_new(false, NULL);; | ||
if (check_error_may_print(__FILE__, __LINE__)) goto cleanup; | ||
TypeDBDriver* driver = driver_open_with_description(address, creds, options, DRIVER_LANG); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we discussed with @flyingsilverfin that we want a separate This function should be:
We can rename |
||
cleanup: | ||
driver_options_drop(options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it noop if there is nothing to drop? |
||
credentials_drop(creds); | ||
|
||
return driver; | ||
} | ||
|
||
int main() { | ||
const char databaseName[] = "test_assembly_clib"; | ||
|
||
Connection* connection = NULL; | ||
DatabaseManager* databaseManager = NULL; | ||
TypeDBDriver* driver = NULL; | ||
|
||
bool success = false; | ||
|
||
connection = driver_open_core(TYPEDB_CORE_ADDRESS, DRIVER_LANG); | ||
if (FAILED()) goto cleanup; | ||
|
||
databaseManager = database_manager_new(connection); | ||
driver = driver_open_for_tests(TYPEDB_CORE_ADDRESS, TYPEDB_CORE_USERNAME, TYPEDB_CORE_PASSWORD); | ||
if (FAILED()) goto cleanup; | ||
|
||
databases_create(databaseManager, databaseName); | ||
databases_create(driver, databaseName); | ||
if (FAILED()) goto cleanup; | ||
|
||
if (!databases_contains(databaseManager, databaseName)) { | ||
if (!databases_contains(driver, databaseName)) { | ||
fprintf(stderr, "databases_contains(\'%s\') failed\n", databaseName); | ||
goto cleanup; | ||
} | ||
|
||
success = true; | ||
cleanup: | ||
check_error_may_print(__FILE__, __LINE__); | ||
database_manager_drop(databaseManager); | ||
driver_close(connection); | ||
driver_close(driver); | ||
|
||
printf("Success: %s\n", success ? "true" : "false"); | ||
return success ? 0 : 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it fix, again? I think I saw a similar PR, but I don't remember