Debian Codegraph @

tests/functional/database/07-incompatible.t

raw
1 #!/bin/bash
2 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
3 # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # -----------------------------------------------------------------------------
18 # Test that operating on a Cylc 7 workflow fails due to database incompatibility,
19 # and that suitable error message is given.
20
21 . "$(dirname "$0")/test_header"
22 set_test_number 6
23
24 install_workflow
25 # install the cylc7 restart database
26 SRV_DIR="${WORKFLOW_RUN_DIR}/.service"
27 mkdir "$SRV_DIR"
28 sqlite3 "${SRV_DIR}/db" < 'db.sqlite3'
29 sqlite3 "${SRV_DIR}/db" '.tables' > orig_tables.txt
30
31 run_ok "${TEST_NAME_BASE}-validate" cylc validate "$WORKFLOW_NAME"
32
33 TEST_NAME="${TEST_NAME_BASE}-play-fail"
34 run_fail "$TEST_NAME" cylc play "$WORKFLOW_NAME"
35 grep_ok \
36 'Workflow database is incompatible with Cylc .*, or is corrupted' \
37 "${TEST_NAME}.stderr"
38
39 # Check no new tables have been created
40 cmp_ok orig_tables.txt <<< "$(sqlite3 "${SRV_DIR}/db" '.tables')"
41
42 TEST_NAME="${TEST_NAME_BASE}-clean-fail"
43 run_fail "$TEST_NAME" cylc clean "$WORKFLOW_NAME"
44 grep_ok \
45 'This database is either corrupted or not compatible with this' \
46 "${TEST_NAME}.stderr"
47
48 purge
49
50 # Note: The test for "trying to restart a workflow without a database gives.
51 # suitable error message" was removed with the change from cylc run/restart to
52 # cylc play, as if the database is not present it will simply do a cold start.
53
54 exit