Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
7b5027f0
Commit
7b5027f0
authored
Jul 06, 2017
by
Kevin Atkinson
Committed by
Jeromy
Sep 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic tests for Spec config change
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
5027b4b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
test/sharness/t0024-datastore-config.sh
test/sharness/t0024-datastore-config.sh
+114
-0
No files found.
test/sharness/t0024-datastore-config.sh
0 → 100755
View file @
7b5027f0
#!/bin/sh
test_description
=
"Test datastore config"
.
lib/test-lib.sh
test_init_ipfs
test_launch_ipfs_daemon
test_kill_ipfs_daemon
SPEC_ORIG
=
$(
cat
<<
EOF
)
{
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
}
EOF
SPEC_NOSYNC
=
$(
cat
<<
'
EOF
')
{
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": false,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
}
EOF
SPEC_NEWSHARDFUN
=
$(
cat
<<
'
EOF
')
{
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/3",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
}
EOF
test_expect_success
"change runtime value in spec config"
'
ipfs config --json Datastore.Spec "$SPEC_NOSYNC"
'
test_launch_ipfs_daemon
test_kill_ipfs_daemon
test_expect_success
"change on-disk value in spec config"
'
ipfs config --json Datastore.Spec "$SPEC_NEWSHARDFUN"
'
test_expect_success
"can not launch daemon after on-disk value change"
'
test_must_fail ipfs daemon
'
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment