Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cppinttest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cppinttest
Commits
c70ce336
Commit
c70ce336
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: rename get_env_var to get_env_fallback
parent
c10ce9ce
No related branches found
No related tags found
No related merge requests found
Pipeline
#12584
passed
3 years ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
test/caosdb_test_utility.h
+10
-12
10 additions, 12 deletions
test/caosdb_test_utility.h
test/test_ccaosdb.cpp
+1
-1
1 addition, 1 deletion
test/test_ccaosdb.cpp
test/test_connection.cpp
+9
-9
9 additions, 9 deletions
test/test_connection.cpp
test/test_transaction.cpp
+1
-1
1 addition, 1 deletion
test/test_transaction.cpp
with
21 additions
and
23 deletions
test/caosdb_test_utility.h
+
10
−
12
View file @
c70ce336
...
@@ -32,17 +32,15 @@
...
@@ -32,17 +32,15 @@
* @date 2021-07-07
* @date 2021-07-07
*/
*/
#define EXPECT_THROW_MESSAGE(statement, exeption_type, message) \
#define EXPECT_THROW_MESSAGE(statement, exeption_type, message) \
EXPECT_THROW( \
EXPECT_THROW(try { statement; } catch (const exeption_type &e) { \
try { statement; } catch (const exeption_type &e) { \
EXPECT_EQ(std::string(e.what()), message); \
EXPECT_EQ(std::string(e.what()), message); \
throw; \
throw; \
}, \
}, \
exeption_type)
exeption_type)
#define ASSERT_THROW_MESSAGE(statement, exeption_type, message) \
#define ASSERT_THROW_MESSAGE(statement, exeption_type, message) \
ASSERT_THROW( \
ASSERT_THROW(try { statement; } catch (const exeption_type &e) { \
try { statement; } catch (const exeption_type &e) { \
ASSERT_EQ(std::string(e.what()), message); \
ASSERT_EQ(std::string(e.what()), message); \
throw; \
throw; \
}, \
}, \
exeption_type)
exeption_type)
#endif
#endif
This diff is collapsed.
Click to expand it.
test/test_ccaosdb.cpp
+
1
−
1
View file @
c70ce336
...
@@ -356,7 +356,7 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
...
@@ -356,7 +356,7 @@ TEST_F(test_ccaosdb, test_insert_update_delete) {
// Change name and update
// Change name and update
return_code
=
return_code
=
caosdb_entity_entity_set_name
(
&
retrieved_entity_1
,
"TestNameNew"
);
caosdb_entity_entity_set_name
(
&
retrieved_entity_1
,
"TestNameNew"
);
EXPECT_EQ
(
return_code
,
0
);
EXPECT_EQ
(
return_code
,
0
);
caosdb_transaction_transaction
update_transaction
;
caosdb_transaction_transaction
update_transaction
;
caosdb_connection_connection_create_transaction
(
&
connection
,
caosdb_connection_connection_create_transaction
(
&
connection
,
...
...
This diff is collapsed.
Click to expand it.
test/test_connection.cpp
+
9
−
9
View file @
c70ce336
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include
"caosdb/constants.h"
// for COMPATIBLE_SERVER_VERSION_M...
#include
"caosdb/constants.h"
// for COMPATIBLE_SERVER_VERSION_M...
#include
"caosdb/exceptions.h"
// for AuthenticationError, Connec...
#include
"caosdb/exceptions.h"
// for AuthenticationError, Connec...
#include
"caosdb/info.h"
// for VersionInfo
#include
"caosdb/info.h"
// for VersionInfo
#include
"caosdb/utility.h"
// for get_env_
var
#include
"caosdb/utility.h"
// for get_env_
fallback
#include
"caosdb_test_utility.h"
// for EXPECT_THROW_MESSAGE
#include
"caosdb_test_utility.h"
// for EXPECT_THROW_MESSAGE
#include
"gtest/gtest_pred_impl.h"
// NOLINT TODO how to fix this? for Test, TestInfo, TEST, EXPEC...
#include
"gtest/gtest_pred_impl.h"
// NOLINT TODO how to fix this? for Test, TestInfo, TEST, EXPEC...
#include
<gtest/gtest-message.h>
// for Message
#include
<gtest/gtest-message.h>
// for Message
...
@@ -62,10 +62,10 @@ TEST(test_connection, connect_somehost_42347_fails) {
...
@@ -62,10 +62,10 @@ TEST(test_connection, connect_somehost_42347_fails) {
TEST
(
test_connection
,
connection_insecure_authentication_error_anonymous
)
{
TEST
(
test_connection
,
connection_insecure_authentication_error_anonymous
)
{
const
auto
*
port_str
=
const
auto
*
port_str
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_GRPC_PORT_HTTP"
,
"8080"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_GRPC_PORT_HTTP"
,
"8080"
);
auto
port
=
std
::
stoi
(
port_str
);
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
const
auto
*
const
host
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
auto
config
=
InsecureConnectionConfiguration
(
host
,
port
);
auto
config
=
InsecureConnectionConfiguration
(
host
,
port
);
auto
connection
=
Connection
(
config
);
auto
connection
=
Connection
(
config
);
...
@@ -75,12 +75,12 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) {
...
@@ -75,12 +75,12 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) {
TEST
(
test_connection
,
connection_ssl_authentication_error_anonymous
)
{
TEST
(
test_connection
,
connection_ssl_authentication_error_anonymous
)
{
const
auto
*
port_str
=
const
auto
*
port_str
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
auto
port
=
std
::
stoi
(
port_str
);
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
const
auto
*
const
host
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
const
auto
path
=
const
auto
path
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
auto
cert
=
PemFileCertificateProvider
(
path
);
auto
cert
=
PemFileCertificateProvider
(
path
);
auto
config
=
TlsConnectionConfiguration
(
host
,
port
,
cert
);
auto
config
=
TlsConnectionConfiguration
(
host
,
port
,
cert
);
...
@@ -94,12 +94,12 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
...
@@ -94,12 +94,12 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
TEST
(
test_connection
,
connection_ssl_authentication_error_wrong_credentials
)
{
TEST
(
test_connection
,
connection_ssl_authentication_error_wrong_credentials
)
{
const
auto
*
port_str
=
const
auto
*
port_str
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
auto
port
=
std
::
stoi
(
port_str
);
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
const
auto
*
const
host
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
const
auto
path
=
const
auto
path
=
caosdb
::
utility
::
get_env_
var
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
caosdb
::
utility
::
get_env_
fallback
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
const
auto
*
const
user
=
"not-a-user-23461237"
;
const
auto
*
const
user
=
"not-a-user-23461237"
;
const
auto
*
const
password
=
"very-c-cred"
;
const
auto
*
const
password
=
"very-c-cred"
;
...
...
This diff is collapsed.
Click to expand it.
test/test_transaction.cpp
+
1
−
1
View file @
c70ce336
...
@@ -812,7 +812,7 @@ TEST_F(test_transaction, test_file_up_n_download) {
...
@@ -812,7 +812,7 @@ TEST_F(test_transaction, test_file_up_n_download) {
auto
download_transaction
(
connection
->
CreateTransaction
());
auto
download_transaction
(
connection
->
CreateTransaction
());
download_transaction
->
RetrieveAndDownloadFileById
(
download_transaction
->
RetrieveAndDownloadFileById
(
inserted_file
.
GetId
(),
test_download_file_1
.
string
());
inserted_file
.
GetId
(),
test_download_file_1
.
string
());
download_transaction
->
ExecuteAsynchronously
();
download_transaction
->
ExecuteAsynchronously
();
ASSERT_EQ
(
download_transaction
->
WaitForIt
().
GetCode
(),
StatusCode
::
SUCCESS
);
ASSERT_EQ
(
download_transaction
->
WaitForIt
().
GetCode
(),
StatusCode
::
SUCCESS
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment