Skip to content

Commit 58f7d49

Browse files
committed
Prepare fda test script to run in CI.
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
1 parent c42fa1b commit 58f7d49

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

crates/fda/test.bash

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
22
set -ex
33

4+
FDA_BINARY=${FDA_BINARY:-../../target/debug/fda}
5+
6+
fda() {
7+
${FDA_BINARY} "$@"
8+
}
9+
10+
411
fail_on_success() {
512
# Run the command with `|| true` to prevent `set -e` from exiting the script
613
set +e
@@ -31,14 +38,7 @@ compare_output() {
3138
return 0
3239
}
3340

34-
fda() {
35-
../../target/debug/fda "$@"
36-
}
37-
#export FELDERA_HOST=http://localhost:8080
38-
39-
cargo build
40-
41-
EDITION=`curl "${FELDERA_HOST%/}/v0/config" | jq .edition | sed s/\"//g`
41+
EDITION=`curl -H "Authorization: Bearer ${FELDERA_API_KEY}" "${FELDERA_HOST%/}/v0/config" | jq .edition | sed s/\"//g`
4242
echo "Edition: $EDITION"
4343
case $EDITION in
4444
Enterprise) enterprise=true ;;
@@ -68,14 +68,15 @@ fda apikey delete a
6868
echo "base64 = '0.22.1'" > udf.toml
6969
echo "use feldera_sqllib::F32;" > udf.rs
7070
cat > program.sql <<EOF
71-
CREATE TABLE example ( id INT NOT NULL PRIMARY KEY ) WITH ('connectors' = '[{ "name": "c", "transport": { "name": "datagen", "config": { "plan": [{ "limit": 1 }] } } }]');
71+
CREATE TABLE example ( id INT NOT NULL PRIMARY KEY ) WITH ('materialized' = 'true', 'connectors' = '[{ "name": "c", "transport": { "name": "datagen", "config": { "plan": [{ "limit": 1 }] } } }]');
7272
CREATE VIEW example_count WITH ('connectors' = '[{ "name": "c", "transport": { "name": "file_output", "config": { "path": "bla" } }, "format": { "name": "csv" } }]') AS ( SELECT COUNT(*) AS num_rows FROM example );
7373
EOF
7474

7575
fda create p1 program.sql
7676
fda program get p1 | fda create p2 -s
7777
compare_output "fda program get p1" "fda program get p2"
7878
fda program set-config p1 --profile dev
79+
fda program set-config p1 --profile optimized
7980
fda program config p1
8081
fda program status p1
8182

@@ -98,21 +99,26 @@ fda logs p1
9899
fda connector p1 example c stats
99100
fda connector p1 example_count c stats
100101
fda connector p1 example unknown stats || true
101-
102-
# Transaction tests
103-
echo "Testing transaction commands..."
104-
fail_on_success fda commit-transaction p1
105-
fda start-transaction p1
106-
fail_on_success fda commit-transaction p1 --tid 999
107-
fda commit-transaction p1
108-
fda start-transaction p1
109-
fda commit-transaction p1 --timeout 10
110-
fda start-transaction p1
111-
fda commit-transaction p1 --no-wait
102+
# Connectors
112103
fda connector p1 example c pause
113104
fda connector p1 example_count c pause || true
114105
fda connector p1 example c start
115106
fda connector p1 example unknown start || true
107+
108+
# Adhoc queries
109+
fda query p1 "SELECT * FROM example"
110+
111+
# Transaction tests
112+
#echo "Testing transaction commands..."
113+
#fail_on_success fda commit-transaction p1
114+
#fda start-transaction p1
115+
#fail_on_success fda commit-transaction p1 --tid 999
116+
#fda commit-transaction p1
117+
#fda start-transaction p1
118+
#fda commit-transaction p1 --timeout 10
119+
#fda start-transaction p1
120+
#fda commit-transaction p1 --no-wait
121+
116122
fda shutdown p1
117123

118124
if $enterprise; then
@@ -130,8 +136,8 @@ fail_on_success fda set-config p1 fault_tolerance exactly_one
130136
fail_on_success fda program set-config p1 -p optimized --runtime-version invalid-version
131137

132138
# Test dev_tweaks setting
133-
fda set-config sec-ops dev_tweaks '{"x": 2}'
134-
fail_on_success fda set-config sec-ops dev_tweaks 'invalid-json'
139+
fda set-config p1 dev_tweaks '{"x": 2}'
140+
fail_on_success fda set-config p1 dev_tweaks 'invalid-json'
135141

136142
fda delete p1
137143
fda delete p2

0 commit comments

Comments
 (0)