Debian Codegraph @

tests/functional/remote/01-file-install.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 # test file installation to remote platforms
19
20 export REQUIRE_PLATFORM='loc:remote comms:?(tcp|ssh)'
21 . "$(dirname "$0")/test_header"
22 set_test_number 6
23
24 create_files () {
25 # dump some files into the run dir
26 for DIR in "bin" "ana" "app" "etc" "lib" "dir1" "dir2" "etc/share" "share"
27 do
28 mkdir -p "${WORKFLOW_RUN_DIR}/${DIR}"
29 touch "${WORKFLOW_RUN_DIR}/${DIR}/moo"
30 done
31 for FILE in "file1" "file2"
32 do
33 touch "${WORKFLOW_RUN_DIR}/${FILE}"
34 done
35 }
36
37 # Test configured files/directories along with default files/directories
38 # (ana, app, bin, etc, lib) are correctly installed on the remote platform.
39 TEST_NAME="${TEST_NAME_BASE}-default-paths"
40 init_workflow "${TEST_NAME}" <<__FLOW_CONFIG__
41 [scheduling]
42 [[graph]]
43 R1 = foo
44 [runtime]
45 [[foo]]
46 platform = $CYLC_TEST_PLATFORM
47 __FLOW_CONFIG__
48 RUN_DIR_REL="${WORKFLOW_RUN_DIR#"${HOME}"/}"
49
50 create_files
51
52 # run the flow
53 run_ok "${TEST_NAME}-validate" cylc validate "${WORKFLOW_NAME}" \
54 -s "CYLC_TEST_PLATFORM='${CYLC_TEST_PLATFORM}'"
55 workflow_run_ok "${TEST_NAME}-run1" cylc play "${WORKFLOW_NAME}" \
56 --no-detach \
57 -s "CYLC_TEST_PLATFORM='${CYLC_TEST_PLATFORM}'"
58
59 # ensure these files get installed on the remote platform
60 SSH="$(cylc config -d -i "[platforms][$CYLC_TEST_PLATFORM]ssh command")"
61 ${SSH} "${CYLC_TEST_HOST}" \
62 find "${RUN_DIR_REL}/"{ana,app,bin,etc,lib} -type f | sort > 'find.out'
63 cmp_ok 'find.out' <<__OUT__
64 ${RUN_DIR_REL}/ana/moo
65 ${RUN_DIR_REL}/app/moo
66 ${RUN_DIR_REL}/bin/moo
67 ${RUN_DIR_REL}/etc/moo
68 ${RUN_DIR_REL}/etc/share/moo
69 ${RUN_DIR_REL}/lib/moo
70 __OUT__
71
72 purge
73 # -----------------------------------------------------------------------------
74
75 # Test the [scheduler]install configuration
76 TEST_NAME="${TEST_NAME_BASE}-configured-paths"
77 init_workflow "${TEST_NAME}" <<__FLOW_CONFIG__
78 [scheduler]
79 install = dir1/, dir2/, file1, file2
80 [scheduling]
81 [[graph]]
82 R1 = foo
83 [runtime]
84 [[foo]]
85 platform = $CYLC_TEST_PLATFORM
86 __FLOW_CONFIG__
87 RUN_DIR_REL="${WORKFLOW_RUN_DIR#"${HOME}"/}"
88
89 create_files
90
91 run_ok "${TEST_NAME}-validate" cylc validate "${WORKFLOW_NAME}" \
92 -s "CYLC_TEST_PLATFORM='${CYLC_TEST_PLATFORM}'"
93 workflow_run_ok "${TEST_NAME}-run2" cylc play "${WORKFLOW_NAME}" \
94 --no-detach \
95 -s "CYLC_TEST_PLATFORM='${CYLC_TEST_PLATFORM}'"
96
97 ${SSH} "${CYLC_TEST_HOST}" \
98 find "${RUN_DIR_REL}/"{ana,app,bin,dir1,dir2,file1,file2,etc,lib} -type f | sort > 'find.out'
99 cmp_ok 'find.out' <<__OUT__
100 ${RUN_DIR_REL}/ana/moo
101 ${RUN_DIR_REL}/app/moo
102 ${RUN_DIR_REL}/bin/moo
103 ${RUN_DIR_REL}/dir1/moo
104 ${RUN_DIR_REL}/dir2/moo
105 ${RUN_DIR_REL}/etc/moo
106 ${RUN_DIR_REL}/etc/share/moo
107 ${RUN_DIR_REL}/file1
108 ${RUN_DIR_REL}/file2
109 ${RUN_DIR_REL}/lib/moo
110 __OUT__
111
112 purge
113 exit