Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
dCache
cta
Commits
67a71ec3
Commit
67a71ec3
authored
6 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
Created a (disabled) Oracle based version of unit test.
This setup allows reproducing a but seen in system tests.
parent
272c99ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
+31
-0
31 additions, 0 deletions
...castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
with
32 additions
and
0 deletions
tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
+
1
−
0
View file @
67a71ec3
...
...
@@ -94,6 +94,7 @@ add_library(ctatapeserverdaemonunittests SHARED
RecallReportPackerTest.cpp
RecallTaskInjectorTest.cpp
TaskWatchDogTest.cpp
${
CMAKE_BINARY_DIR
}
/catalogue/OracleCatalogueSchema.cpp
)
set_property
(
TARGET ctatapeserverdaemonunittests PROPERTY SOVERSION
"
${
CTA_SOVERSION
}
"
)
set_property
(
TARGET ctatapeserverdaemonunittests PROPERTY VERSION
"
${
CTA_LIBVERSION
}
"
)
...
...
This diff is collapsed.
Click to expand it.
tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
+
31
−
0
View file @
67a71ec3
...
...
@@ -34,6 +34,8 @@
#include
"castor/tape/tapeserver/file/File.hpp"
#include
"castor/tape/tapeserver/drive/FakeDrive.hpp"
#include
"catalogue/InMemoryCatalogue.hpp"
#include
"catalogue/OracleCatalogue.hpp"
#include
"catalogue/OracleCatalogueSchema.hpp"
#include
"common/exception/Exception.hpp"
#include
"common/log/DummyLogger.hpp"
#include
"common/log/StringLogger.hpp"
...
...
@@ -111,6 +113,15 @@ public:
}
};
#undef USE_ORACLE_CATALOGUE
#ifdef USE_ORACLE_CATALOGUE
class
OracleCatalogueExposingConnection
:
public
cta
::
catalogue
::
OracleCatalogue
{
public:
template
<
typename
...
Ts
>
OracleCatalogueExposingConnection
(
Ts
&
...
args
)
:
cta
::
catalogue
::
OracleCatalogue
(
args
...)
{}
cta
::
rdbms
::
Conn
getConn
()
{
return
m_connPool
.
getConn
();
}
};
#endif
virtual
void
SetUp
()
{
using
namespace
cta
;
...
...
@@ -119,9 +130,26 @@ public:
const
uint64_t
nbConns
=
1
;
const
uint64_t
nbArchiveFileListingConns
=
1
;
const
uint32_t
maxTriesToConnect
=
1
;
#ifdef USE_ORACLE_CATALOGUE
cta
::
rdbms
::
Login
login
=
cta
::
rdbms
::
Login
::
parseFile
(
"/etc/cta/cta-catalogue.conf"
);
m_catalogue
=
cta
::
make_unique
<
OracleCatalogueExposingConnection
>
(
m_dummyLog
,
login
.
username
,
login
.
password
,
login
.
database
,
nbConns
,
nbArchiveFileListingConns
,
maxTriesToConnect
);
try
{
// If we decide to create an oracle catalogue, we have to prepare it.
// This is a striped down version of CreateSchemaCmd.
OracleCatalogueExposingConnection
&
oracleCatalogue
=
dynamic_cast
<
OracleCatalogueExposingConnection
&>
(
*
m_catalogue
);
auto
conn
=
oracleCatalogue
.
getConn
();
for
(
auto
&
name
:
conn
.
getTableNames
())
if
(
name
==
"CTA_CATALOGUE"
)
throw
cta
::
exception
::
Exception
(
"In SetUp(): schema is already populated."
);
cta
::
catalogue
::
OracleCatalogueSchema
schema
;
conn
.
executeNonQueries
(
schema
.
sql
);
}
catch
(
std
::
bad_cast
&
)
{}
#else
//m_catalogue = cta::make_unique<catalogue::SchemaCreatingSqliteCatalogue>(m_tempSqliteFile.path(), nbConns);
m_catalogue
=
cta
::
make_unique
<
catalogue
::
InMemoryCatalogue
>
(
m_dummyLog
,
nbConns
,
nbArchiveFileListingConns
,
maxTriesToConnect
);
#endif
m_scheduler
=
cta
::
make_unique
<
Scheduler
>
(
*
m_catalogue
,
*
m_db
,
5
,
2
*
1000
*
1000
);
strncpy
(
m_tmpDir
,
"/tmp/DataTransferSessionTestXXXXXX"
,
sizeof
(
m_tmpDir
));
...
...
@@ -1466,6 +1494,8 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
castorConf
.
bulkRequestMigrationMaxBytes
=
UINT64_C
(
100
)
*
1000
*
1000
*
1000
;
castorConf
.
bulkRequestMigrationMaxFiles
=
1000
;
castorConf
.
nbDiskThreads
=
1
;
castorConf
.
maxBytesBeforeFlush
=
9999999
;
castorConf
.
maxFilesBeforeFlush
=
9999999
;
cta
::
log
::
DummyLogger
dummyLog
(
"dummy"
,
"dummy"
);
cta
::
mediachanger
::
MediaChangerFacade
mc
(
dummyLog
);
cta
::
server
::
ProcessCap
capUtils
;
...
...
@@ -1483,6 +1513,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
pos
+=
successLog
.
size
();
count
++
;
}
//std::cout << logger.getLog() << std::endl;
ASSERT_EQ
(
5
,
count
);
cta
::
catalogue
::
TapeSearchCriteria
tapeCriteria
;
tapeCriteria
.
vid
=
s_vid
;
...
...
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