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
69b0b413
Commit
69b0b413
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Add NOLINTs and output
parent
6a82bb22
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
TST: Add Tests for insert and delete
Pipeline
#11206
failed
3 years ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_connection.cpp
+5
-2
5 additions, 2 deletions
test/test_connection.cpp
test/test_transaction.cpp
+11
-5
11 additions, 5 deletions
test/test_transaction.cpp
with
16 additions
and
7 deletions
test/test_connection.cpp
+
5
−
2
View file @
69b0b413
...
...
@@ -73,7 +73,8 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) {
EXPECT_THROW
(
connection
.
RetrieveVersionInfo
(),
AuthenticationError
);
}
TEST
(
test_connection
,
connection_ssl_authentication_error_anonymous
)
{
// TODO(tf) cognitive complexity > 25 (threshold)
TEST
(
test_connection
,
connection_ssl_authentication_error_anonymous
)
{
// NOLINT
const
auto
*
port_str
=
caosdb
::
utility
::
get_env_var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
auto
port
=
std
::
stoi
(
port_str
);
...
...
@@ -92,7 +93,9 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
"succeed. Original error: Please login."
);
}
TEST
(
test_connection
,
connection_ssl_authentication_error_wrong_credentials
)
{
// TODO(tf) cognitive complexity > 25 (threshold)
TEST
(
test_connection
,
// NOLINT
connection_ssl_authentication_error_wrong_credentials
)
{
// NOLINT
const
auto
*
port_str
=
caosdb
::
utility
::
get_env_var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"8443"
);
auto
port
=
std
::
stoi
(
port_str
);
...
...
This diff is collapsed.
Click to expand it.
test/test_transaction.cpp
+
11
−
5
View file @
69b0b413
...
...
@@ -27,6 +27,7 @@
#include
"gtest/gtest-message.h"
// for Message
#include
"gtest/gtest-test-part.h"
// for TestPartResult, SuiteApiResolver
#include
"gtest/gtest_pred_impl.h"
// for Test, EXPECT_EQ, AssertionResult
#include
<iostream>
// for endl, basic_ostream, cout
#include
<memory>
// for unique_ptr, allocator, __shar...
#include
<string>
// for string
...
...
@@ -94,7 +95,8 @@ TEST(test_transaction, retrieve_non_existing) {
MessageCode
::
ENTITY_DOES_NOT_EXIST
);
}
TEST
(
test_transaction
,
insert_delete
)
{
// TODO(fspreck) cognitive complexity > 25 (threshold)
TEST
(
test_transaction
,
insert_delete
)
{
// NOLINT
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
...
...
@@ -142,8 +144,8 @@ TEST(test_transaction, insert_delete) {
}
// TODO(fspreck) Simplify inserts and deletes once we have
// multi-entity operations
TEST
(
test_transaction
,
insert_delete_with_parent
)
{
// multi-entity operations
, also cognitive complexity > threshold
TEST
(
test_transaction
,
insert_delete_with_parent
)
{
// NOLINT
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
...
...
@@ -170,7 +172,8 @@ TEST(test_transaction, insert_delete_with_parent) {
rec
.
SetName
(
"TestRec"
);
Parent
parent
;
parent
.
SetName
(
rt
.
GetName
());
parent
.
SetName
(
inserted_rt
.
GetName
());
parent
.
SetId
(
inserted_rt
.
GetId
());
rec
.
AppendParent
(
parent
);
auto
rec_transaction
(
connection
->
CreateTransaction
());
...
...
@@ -180,13 +183,16 @@ TEST(test_transaction, insert_delete_with_parent) {
auto
rec_insert_status
=
rec_transaction
->
WaitForIt
();
ASSERT_TRUE
(
rec_insert_status
.
IsTerminated
());
std
::
cout
<<
rec
.
ToString
()
<<
std
::
endl
;
std
::
cout
<<
rec_insert_status
.
GetCode
()
<<
std
::
endl
;
ASSERT_FALSE
(
rec_insert_status
.
IsError
());
const
auto
&
rec_result_set
=
dynamic_cast
<
const
UniqueResult
&>
(
rec_transaction
->
GetResultSet
());
const
auto
&
inserted_rec
=
rec_result_set
.
GetEntity
();
std
::
cout
<<
inserted_rec
.
ToString
()
<<
std
::
endl
;
EXPECT_EQ
(
inserted_rec
.
GetName
(),
rec
.
GetName
());
EXPECT_EQ
(
inserted_rec
.
GetParents
().
Size
(),
1
);
EXPECT_EQ
(
inserted_rec
.
GetParents
().
At
(
0
).
GetId
(),
inserted_rt
.
GetId
());
...
...
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