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
615a96a7
Commit
615a96a7
authored
3 years ago
by
florian
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-full-c
parents
8665598f
72cfe1d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
ENH: Test insert/update/delete and files in Extern C
Pipeline
#12183
passed
3 years ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/CMakeLists.txt
+1
-0
1 addition, 0 deletions
test/CMakeLists.txt
test/test_file_transmission.cpp
+6
-0
6 additions, 0 deletions
test/test_file_transmission.cpp
test/test_transaction.cpp
+19
-1
19 additions, 1 deletion
test/test_transaction.cpp
with
26 additions
and
1 deletion
test/CMakeLists.txt
+
1
−
0
View file @
615a96a7
...
...
@@ -24,6 +24,7 @@
set
(
test_cases
test_connection
test_transaction
#test_file_transmission TODO add once fixed
test_ccaosdb
)
...
...
This diff is collapsed.
Click to expand it.
test/test_file_transmission.cpp
+
6
−
0
View file @
615a96a7
...
...
@@ -36,6 +36,12 @@ using caosdb::entity::v1alpha1::RegisterFileUploadResponse;
using
caosdb
::
entity
::
v1alpha1
::
RegistrationStatus
;
using
caosdb
::
entity
::
v1alpha1
::
TransmissionStatus
;
// TODO(tf) this file is currently not used (see CMakeLists.txt)
// Is it still necessary or is it obsolete due to test_transaction.cpp?
// RegisterFileDownloadResponse is currently not defined by proto or the h
// file.
class
test_file_transmission
:
public
::
testing
::
Test
{
protected:
void
SetUp
()
override
{}
...
...
This diff is collapsed.
Click to expand it.
test/test_transaction.cpp
+
19
−
1
View file @
615a96a7
...
...
@@ -20,6 +20,7 @@
*/
#include
"caosdb/connection.h"
// for Connection, ConnectionManager
#include
"caosdb/entity.h"
// for Entity, Messages, Message
#include
"caosdb/file_transmission/file_reader.h"
// for FileReader
#include
"caosdb/file_transmission/file_writer.h"
// for FileWriter
#include
"caosdb/message_code.h"
// for ENTITY_DOES_NOT_EXIST, Messag...
#include
"caosdb/status_code.h"
// for SUCCESS, StatusCode
...
...
@@ -690,9 +691,18 @@ TEST_F(test_transaction, test_file_upload) {
const
auto
&
inserted_file
=
insert_results
.
at
(
0
);
EXPECT_FALSE
(
inserted_file
.
GetId
().
empty
());
EXPECT_FALSE
(
inserted_file
.
HasErrors
());
// Check file once more
auto
count_query
(
connection
->
CreateTransaction
());
count_query
->
Query
(
"COUNT FILE WHICH IS STORED AT 'test.txt'"
);
count_query
->
ExecuteAsynchronously
();
auto
count_and_retrieve_status
=
count_query
->
WaitForIt
();
ASSERT_TRUE
(
count_and_retrieve_status
.
IsTerminated
());
ASSERT_FALSE
(
count_and_retrieve_status
.
IsError
());
EXPECT_EQ
(
count_query
->
GetCountResult
(),
1
);
}
TEST_F
(
test_transaction
,
test_file_download
)
{
TEST_F
(
test_transaction
,
test_file_
up_n_
download
)
{
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
...
...
@@ -725,6 +735,14 @@ TEST_F(test_transaction, test_file_download) {
ASSERT_FALSE
(
downloaded_file
.
HasErrors
());
EXPECT_EQ
(
downloaded_file
.
GetLocalPath
().
string
(),
test_download_file_1
.
string
());
FileReader
reader_remote
(
test_upload_file_1
);
std
::
string
buffer_local
(
1024
,
'c'
);
std
::
string
buffer_remote
(
1024
,
'c'
);
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
reader_remote
.
read
(
buffer_remote
);
EXPECT_EQ
(
buffer_remote
,
buffer_local
);
}
}
}
// namespace caosdb::transaction
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