Skip to content

Commit cb75626

Browse files
authored
Merge pull request #4315 from garlick/content_sha256
use correct type in content-sqlite, misc. content test cleanup
2 parents 3d52765 + 58a2f23 commit cb75626

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

src/modules/content-sqlite/content-sqlite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const size_t lzo_buf_chunksize = 1024*1024;
3636
const size_t compression_threshold = 256; /* compress blobs >= this size */
3737

3838
const char *sql_create_table = "CREATE TABLE if not exists objects("
39-
" hash CHAR(20) PRIMARY KEY,"
39+
" hash BLOB PRIMARY KEY,"
4040
" size INT,"
4141
" object BLOB"
4242
");";

t/t2008-althash.t

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@ if test -n "$S3_ACCESS_KEY_ID"; then
1818
fi
1919

2020
test_expect_success 'Started instance with content.hash=sha1' '
21-
OUT=$(flux start -o,-Scontent.hash=sha1 \
22-
flux getattr content.hash) && test "$OUT" = "sha1"
21+
OUT=$(flux start -o,-Scontent.hash=sha1 \
22+
flux getattr content.hash) &&
23+
test "$OUT" = "sha1"
2324
'
2425

2526
test_expect_success 'Started instance with content.hash=sha256' '
26-
OUT=$(flux start -o,-Scontent.hash=sha256 \
27-
flux getattr content.hash) && test "$OUT" = "sha256"
27+
OUT=$(flux start -o,-Scontent.hash=sha256 \
28+
flux getattr content.hash) &&
29+
test "$OUT" = "sha256"
2830
'
2931

3032
test_expect_success 'Started instance with content.hash=sha256,content-files' '
31-
OUT=$(flux start -o,-Scontent.hash=sha256 \
32-
-o,-Scontent.backing-module=content-files \
33-
-o,-Sstatedir=$(pwd) \
34-
flux getattr content.hash) && test "$OUT" = "sha256" &&
35-
ls -1 content.files | tail -1 | grep sha256
33+
OUT=$(flux start -o,-Scontent.hash=sha256 \
34+
-o,-Scontent.backing-module=content-files \
35+
-o,-Sstatedir=$(pwd) \
36+
flux getattr content.hash) &&
37+
test "$OUT" = "sha256" &&
38+
ls -1 content.files | tail -1 | grep sha256
3639
'
3740

3841
test_expect_success S3 'create creds.toml from env' '
@@ -55,20 +58,20 @@ test_expect_success S3 'create content-s3.toml from env' '
5558
'
5659

5760
test_expect_success S3 'Started instance with content.hash=sha256,content-s3' '
58-
OUT=$(flux start -o,-Scontent.hash=sha256 \
59-
-o,-Scontent.backing-module=content-s3 \
60-
flux getattr content.hash) && test "$OUT" = "sha256" &&
61-
ls -1 content.files | tail -1 | grep sha256
61+
OUT=$(flux start -o,-Scontent.hash=sha256 \
62+
-o,-Scontent.backing-module=content-s3 \
63+
flux getattr content.hash) &&
64+
test "$OUT" = "sha256"
6265
'
6366
test_expect_success S3 'Content store nil returns correct hash for sha256' '
64-
OUT=$(flux start -o,-Scontent.hash=sha256 \
65-
-o,-Scontent.backing-module=content-s3 \
66-
flux content store </dev/null) &&
67-
test "$OUT" = "$nil256"
67+
OUT=$(flux start -o,-Scontent.hash=sha256 \
68+
-o,-Scontent.backing-module=content-s3 \
69+
flux content store </dev/null) &&
70+
test "$OUT" = "$nil256"
6871
'
6972

7073
test_expect_success 'Attempt to start instance with invalid hash fails hard' '
71-
test_must_fail flux start -o,-Scontent.hash=wronghash /bin/true
74+
test_must_fail flux start -o,-Scontent.hash=wronghash /bin/true
7275
'
7376

7477
test_done

0 commit comments

Comments
 (0)