Skip to content

Commit 7bac374

Browse files
author
ccfelius
committed
adding some tests
1 parent 21c97f1 commit 7bac374

File tree

5 files changed

+121
-7
lines changed

5 files changed

+121
-7
lines changed

test/sql/tpch/naive/sf1/load_sf1.test

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require tpch
1313

1414
# load the DB from disk
1515
statement ok
16-
ATTACH 'lorderkey_tpch_sf1_naive.db' AS encnaive;
16+
ATTACH 'lship_tpch_sf1_naive.db' AS encnaive;
1717

1818
statement ok
1919
CALL dbgen(sf=1);
@@ -25,6 +25,12 @@ CREATE SECRET key_2 (
2525
LENGTH 16
2626
);
2727

28+
statement ok
29+
CREATE TABLE encnaive.lineitem AS
30+
SELECT
31+
encrypt_naive(l_shipmode, 'key_2') AS l_shipmode
32+
FROM lineitem;
33+
2834
statement ok
2935
CREATE TABLE encnaive.lineitem AS
3036
SELECT

test/sql/tpch/sf1/load_lship.test

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# name: test/sql/tpch/load_sf1.test
2+
# description: Test VCRYPT encryption with OpenSSL for Loading TPC-H sf1
3+
# this tests only encrypts one column (l_shipinstruct) from the lineitem table
4+
# group: [vcrypt]
5+
6+
# Ensure any currently stored secrets don't interfere with the test
7+
statement ok
8+
set allow_persistent_secrets=false;
9+
10+
require vcrypt
11+
12+
require tpch
13+
14+
# load the DB from disk
15+
statement ok
16+
ATTACH 'lshipinstruct_tpch_sf1.db' AS enc_ship;
17+
18+
statement ok
19+
CALL dbgen(sf=1);
20+
21+
statement ok
22+
CREATE SECRET key_2 (
23+
TYPE VCRYPT,
24+
TOKEN 'ABCDEFGHIJKLMNOP',
25+
LENGTH 16
26+
);
27+
28+
statement ok
29+
CREATE TABLE enc_ship.lineitem AS
30+
SELECT
31+
encrypt(l_shipinstruct, 'key_2') AS l_shipinstruct,
32+
FROM lineitem;
33+
34+
statement ok
35+
CHECKPOINT;
36+
37+
query I
38+
SELECT decrypt(l_shipinstruct, 'key_2') FROM enc_ship.lineitem LIMIT 5;
39+
----
40+
DELIVER IN PERSON
41+
TAKE BACK RETURN
42+
TAKE BACK RETURN
43+
NONE
44+
NONE
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# name: test/sql/tpch/lshipinstruct.test
2+
# description: Test VCRYPT encryption with OpenSSL for Loading TPC-H sf 0.01
3+
# this tests only encrypts one column (l_shipinstruct) from the lineitem table
4+
# group: [vcrypt]
5+
6+
# Ensure any currently stored secrets don't interfere with the test
7+
statement ok
8+
set allow_persistent_secrets=false;
9+
10+
require vcrypt
11+
12+
require tpch
13+
14+
# load the DB from disk
15+
statement ok
16+
ATTACH 'lshipinstruct_tpch_sf1.db' AS enc_ship;
17+
18+
statement ok
19+
CREATE SECRET key_2 (
20+
TYPE VCRYPT,
21+
TOKEN 'ABCDEFGHIJKLMNOP',
22+
LENGTH 16
23+
);
24+
25+
statement ok
26+
CREATE VIEW lineitem AS
27+
SELECT
28+
decrypt(l_shipinstruct, 'key_2') AS l_shipinstruct
29+
FROM enc_ship.lineitem;
30+
31+
query I
32+
SELECT l_shipinstruct FROM lineitem LIMIT 5;
33+
----
34+
DELIVER IN PERSON
35+
TAKE BACK RETURN
36+
TAKE BACK RETURN
37+
NONE
38+
NONE

test/sql/vectorized/vectorized_decrypt.test

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,43 @@ CREATE SECRET key_1 (
1616
LENGTH 16
1717
);
1818

19-
#CREATE TABLE test_1 AS SELECT 1 AS value FROM range(1000);
2019
statement ok
2120
CREATE TABLE test_1 AS SELECT range AS value FROM range(1000);
2221

2322
statement ok
24-
ALTER TABLE test_1 ADD COLUMN encrypted_values E_BIGINT;
23+
ALTER TABLE test_1 ADD COLUMN value_int INT32;
2524

2625
statement ok
27-
ALTER TABLE test_1 ADD COLUMN decrypted_values BIGINT;
26+
UPDATE test_1 SET value_int = value;
27+
28+
statement ok
29+
ALTER TABLE test_1 DROP COLUMN value;
30+
31+
statement ok
32+
ALTER TABLE test_1 RENAME COLUMN value_int TO value;
33+
34+
statement ok
35+
ALTER TABLE test_1 ADD COLUMN encrypted_values E_INTEGER;
36+
37+
statement ok
38+
ALTER TABLE test_1 ADD COLUMN decrypted_values INTEGER;
2839

2940
statement ok
3041
UPDATE test_1 SET encrypted_values = encrypt(value, 'key_1');
3142

3243
statement ok
33-
UPDATE test_1 SET decrypted_values = decrypt(encrypted_values, 'key_1');
44+
UPDATE test_1 SET decrypted_values = decrypt(encrypted_values, 'key_1');
45+
46+
query I
47+
select value, decrypted_values from test_1 limit 10;
48+
----
49+
0 0
50+
1 1
51+
2 2
52+
3 3
53+
4 4
54+
5 5
55+
6 6
56+
7 7
57+
8 8
58+
9 9

test/sql/vectorized/vectorized_encrypt.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ CREATE SECRET key_1 (
1616
LENGTH 16
1717
);
1818

19-
#CREATE TABLE test_1 AS SELECT 1 AS value FROM range(1000);
2019
statement ok
2120
CREATE TABLE test_1 AS SELECT row_number() OVER () AS value FROM range(1000);
2221

@@ -26,4 +25,6 @@ ALTER TABLE test_1 ADD COLUMN encrypted_values E_INTEGER;
2625
statement ok
2726
UPDATE test_1 SET encrypted_values = encrypt(value, 'key_1');
2827

29-
28+
query I
29+
Select * from test_1 limit 10;
30+
----

0 commit comments

Comments
 (0)