Debian Codegraph @

tests/f/cylc-reinstall/00-simple.t

raw
1 #!/usr/bin/env 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 #------------------------------------------------------------------------------
19 # Test workflow re-installation
20 . "$(dirname "$0")/test_header"
21 set_test_number 11
22
23 # Test basic cylc reinstall, named run given
24 TEST_NAME="${TEST_NAME_BASE}-basic-named-run"
25 make_rnd_workflow
26 pushd "${RND_WORKFLOW_SOURCE}" || exit 1
27 run_ok "${TEST_NAME}" cylc install
28 cmp_ok "${TEST_NAME}.stdout" <<__OUT__
29 INSTALLED $RND_WORKFLOW_NAME/run1 from ${RND_WORKFLOW_SOURCE}
30 __OUT__
31 run_ok "basic-reinstall" cylc reinstall "${RND_WORKFLOW_NAME}/run1"
32 REINSTALL_LOG="$(find "${RND_WORKFLOW_RUNDIR}/run1/log/install" -type f -name '*reinstall.log')"
33 grep_ok "REINSTALLED ${RND_WORKFLOW_NAME}/run1 from ${RND_WORKFLOW_SOURCE}" "${REINSTALL_LOG}"
34
35 popd || exit 1
36 purge_rnd_workflow
37
38 #------------------------------------------------------------------------------
39 # Test install/reinstall executed from elsewhere in filesystem
40 TEST_NAME="${TEST_NAME_BASE}-named-flow"
41 make_rnd_workflow
42 pushd "${TMPDIR}" || exit 1
43 run_ok "${TEST_NAME}-install" cylc install "${RND_WORKFLOW_SOURCE}" --workflow-name="${RND_WORKFLOW_NAME}"
44 cmp_ok "${TEST_NAME}-install.stdout" <<__OUT__
45 INSTALLED ${RND_WORKFLOW_NAME}/run1 from ${RND_WORKFLOW_SOURCE}
46 __OUT__
47 run_ok "${TEST_NAME}-reinstall" cylc reinstall "${RND_WORKFLOW_NAME}/run1"
48 cmp_ok "${TEST_NAME}-reinstall.stdout" <<__OUT__
49 REINSTALLED $RND_WORKFLOW_NAME/run1 from ${RND_WORKFLOW_SOURCE}
50 Successfully reinstalled.
51 Done
52 __OUT__
53 popd || exit 1
54 purge_rnd_workflow
55 rm -rf "${RUN_DIR:?}/${RND_WORKFLOW_NAME}/"
56
57 #------------------------------------------------------------------------------
58 # Test cylc reinstall succeeds if suite.rc file in source dir
59 TEST_NAME="${TEST_NAME_BASE}-no-flow-file"
60 make_rnd_workflow
61 rm -f "${RND_WORKFLOW_SOURCE}/flow.cylc"
62 touch "${RND_WORKFLOW_SOURCE}/suite.rc"
63 run_ok "${TEST_NAME}" cylc install "${RND_WORKFLOW_SOURCE}" --workflow-name="${RND_WORKFLOW_NAME}"
64 cmp_ok "${TEST_NAME}.stdout" <<__OUT__
65 INSTALLED $RND_WORKFLOW_NAME/run1 from ${RND_WORKFLOW_SOURCE}
66 __OUT__
67
68 run_ok "${TEST_NAME}-reinstall" cylc reinstall "${RND_WORKFLOW_NAME}/run1"
69 purge_rnd_workflow
70
71 exit