Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kubo_final
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anastasiia Chirikova
kubo_final
Commits
3bf7d5c2
Commit
3bf7d5c2
authored
10 years ago
by
Jeromy Johnson
Browse files
Options
Downloads
Patches
Plain Diff
test for pinning semantics
parent
6bf34130
No related branches found
No related tags found
1 merge request
!1
New
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pin/pin_test.go
+38
-0
38 additions, 0 deletions
pin/pin_test.go
test/sharness/t0080-repo.sh
+2
-1
2 additions, 1 deletion
test/sharness/t0080-repo.sh
with
40 additions
and
1 deletion
pin/pin_test.go
+
38
−
0
View file @
3bf7d5c2
...
...
@@ -152,3 +152,41 @@ func TestPinnerBasic(t *testing.T) {
t
.
Fatal
(
"could not find recursively pinned node"
)
}
}
func
TestDuplicateSemantics
(
t
*
testing
.
T
)
{
dstore
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
bstore
:=
blockstore
.
NewBlockstore
(
dstore
)
bserv
,
err
:=
bs
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
dserv
:=
mdag
.
NewDAGService
(
bserv
)
// TODO does pinner need to share datastore with blockservice?
p
:=
NewPinner
(
dstore
,
dserv
)
a
,
_
:=
randNode
()
_
,
err
=
dserv
.
Add
(
a
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// pin is recursively
err
=
p
.
Pin
(
a
,
true
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// pinning directly should fail
err
=
p
.
Pin
(
a
,
false
)
if
err
==
nil
{
t
.
Fatal
(
"expected direct pin to fail"
)
}
// pinning recursively again should succeed
err
=
p
.
Pin
(
a
,
true
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
This diff is collapsed.
Click to expand it.
test/sharness/t0080-repo.sh
+
2
−
1
View file @
3bf7d5c2
...
...
@@ -48,6 +48,7 @@ test_expect_success "file no longer pinned" '
# we expect the welcome files to show up here
echo "$HASH_WELCOME_DOCS" >expected2 &&
ipfs refs -r "$HASH_WELCOME_DOCS" >>expected2 &&
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >> expected2 &&
sort expected2 >expected_sorted2 &&
ipfs pin ls -type=recursive >actual2 &&
sort actual2 >actual_sorted2 &&
...
...
@@ -127,7 +128,6 @@ test_expect_success "pin something directly" '
test_expect_success
"'ipfs pin ls -type=direct' is correct"
'
echo "$DIRECTPIN" >directpinexpected &&
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >>directpinexpected &&
sort directpinexpected >dp_exp_sorted &&
ipfs pin ls -type=direct >directpinout &&
sort directpinout >dp_out_sorted &&
...
...
@@ -137,6 +137,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
test_expect_success
"'ipfs pin ls -type=recursive' is correct"
'
echo "$MBLOCKHASH" >rp_expected &&
echo "$HASH_WELCOME_DOCS" >>rp_expected &&
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >>rp_expected &&
ipfs refs -r "$HASH_WELCOME_DOCS" >>rp_expected &&
sort rp_expected >rp_exp_sorted &&
ipfs pin ls -type=recursive >rp_actual &&
...
...
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