summaryrefslogtreecommitdiffstats
path: root/azure/aria/aria-extension-cloudify/src/aria/tests/resources/scripts/test_ssh.sh
blob: 1c35370b7cf743a946189d1672f403f292b779ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


set -u
set -e

test_run_script_basic() {
    ctx node attributes test_value = "$test_value"
}

test_run_script_as_sudo() {
    mkdir -p /opt/test_dir
}

test_run_script_default_base_dir() {
    ctx node attributes work_dir = "$PWD"
}

test_run_script_with_hide() {
    true
}

test_run_script_process_config() {
    ctx node attributes env_value = "$test_value_env"
    ctx node attributes bash_version = "$BASH_VERSION"
    ctx node attributes arg1_value = "$1"
    ctx node attributes arg2_value = "$2"
    ctx node attributes cwd = "$PWD"
    ctx node attributes ctx_path = "$(which ctx)"
}

test_run_script_command_prefix() {
    ctx node attributes dollar_dash = $-
}

test_run_script_reuse_existing_ctx_1() {
    ctx node attributes test_value1 = "$test_value1"
}

test_run_script_reuse_existing_ctx_2() {
    ctx node attributes test_value2 = "$test_value2"
}

test_run_script_download_resource_plain() {
    local DESTINATION=$(mktemp)
    ctx download-resource [ "$DESTINATION" test_resource ]
    ctx node attributes test_value = "$(cat "$DESTINATION")"
}

test_run_script_download_resource_and_render() {
    local DESTINATION=$(mktemp)
    ctx download-resource-and-render [ "$DESTINATION" test_resource ]
    ctx node attributes test_value = "$(cat "$DESTINATION")"
}

test_run_script_inputs_as_env_variables_no_override() {
    ctx node attributes test_value = "$custom_env_var"
}

test_run_script_inputs_as_env_variables_process_env_override() {
    ctx node attributes test_value = "$custom_env_var"
}

test_run_script_error_in_script() {
    ctx property-that-does-not-exist
}

test_run_script_abort_immediate() {
    ctx task abort [ abort-message ]
}

test_run_script_retry() {
    ctx task retry [ retry-message ]
}

test_run_script_abort_error_ignored_by_script() {
    set +e
    ctx task abort [ abort-message ]
}

# Injected by test
"$test_operation" "$@"