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
283a8c7c
Commit
283a8c7c
authored
9 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
Added unit tests for library list in RootEntry.
parent
177d565f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
objectstore/RootEntryTest.cpp
+63
-0
63 additions, 0 deletions
objectstore/RootEntryTest.cpp
with
63 additions
and
0 deletions
objectstore/RootEntryTest.cpp
+
63
−
0
View file @
283a8c7c
...
...
@@ -342,4 +342,67 @@ TEST(RootEntry, StorageClassesAndArchivalRoutes) {
re
.
remove
();
ASSERT_EQ
(
false
,
re
.
exists
());
}
TEST
(
RootEntry
,
Libraries
)
{
cta
::
objectstore
::
BackendVFS
be
;
cta
::
objectstore
::
CreationLog
cl
(
99
,
"dummyUser"
,
99
,
"dummyGroup"
,
"unittesthost"
,
time
(
NULL
),
"Creation of unit test agent register"
);
{
// Try to create the root entry
cta
::
objectstore
::
RootEntry
re
(
be
);
re
.
initialize
();
re
.
insert
();
}
{
// Add 2 libraries to the root entry
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedExclusiveLock
lock
(
re
);
ASSERT_NO_THROW
(
re
.
fetch
());
re
.
addLibrary
(
"library1"
,
cl
);
re
.
addLibrary
(
"library2"
,
cl
);
re
.
commit
();
}
{
// Check that the admin hosts made it
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedSharedLock
lock
(
re
);
re
.
fetch
();
ASSERT_TRUE
(
re
.
libraryExists
(
"library1"
));
ASSERT_TRUE
(
re
.
libraryExists
(
"library2"
));
ASSERT_FALSE
(
re
.
libraryExists
(
"library3"
));
}
{
// Check that we can remove existing and non-existing hosts
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedExclusiveLock
lock
(
re
);
re
.
fetch
();
re
.
removeLibrary
(
"library1"
);
re
.
removeAdminHost
(
"library3"
);
re
.
commit
();
}
{
// Check that we cannot re-add an existing host
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedExclusiveLock
lock
(
re
);
re
.
fetch
();
ASSERT_THROW
(
re
.
addLibrary
(
"library2"
,
cl
),
cta
::
objectstore
::
RootEntry
::
DuplicateEntry
);
}
{
// Check that we got the expected result
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedSharedLock
lock
(
re
);
re
.
fetch
();
ASSERT_FALSE
(
re
.
libraryExists
(
"library1"
));
ASSERT_TRUE
(
re
.
libraryExists
(
"library2"
));
ASSERT_FALSE
(
re
.
libraryExists
(
"library3"
));
ASSERT_EQ
(
1
,
re
.
dumpLibraries
().
size
());
ASSERT_EQ
(
"library2"
,
re
.
dumpLibraries
().
front
());
}
// Delete the root entry
cta
::
objectstore
::
RootEntry
re
(
be
);
cta
::
objectstore
::
ScopedExclusiveLock
lock
(
re
);
re
.
remove
();
ASSERT_EQ
(
false
,
re
.
exists
());
}
}
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