-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathserver_command_common_spec_helper.rb
More file actions
48 lines (42 loc) · 1.77 KB
/
server_command_common_spec_helper.rb
File metadata and controls
48 lines (42 loc) · 1.77 KB
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
#
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
# Copyright:: Copyright (c) 2011-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
# License:: Apache License, Version 2.0
#
# Licensed 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.
$:.unshift File.expand_path("../lib", __dir__)
# Common helper methods used accrossed knife plugin during Integration testing.
#
# run_cmd_check_status_and_output: It checks knife plugin command exitstatus(i.e '0' = succeed and '1' = fails)
# and also checks command output(i.e stdout or stderr)
#
# run_cmd_check_stdout: It checks commands stdout.
#
# server_create_common_bfr_aftr: Its contains common before and after blocks used for server create
def run_cmd_check_status_and_output(expected_status = "succeed", expected_result = nil)
it do
match_status("should #{expected_status}")
expect(cmd_output).to include(expected_result) if expected_result
end
end
def run_cmd_check_stdout(expected_result)
it { match_stdout(/#{expected_result}/) }
end
def server_create_common_bfr_aftr(platform = "linux")
before { create_node_name(platform) }
after { run(delete_instance_cmd("#{cmd_output}")) }
end
def rm_known_host
known_hosts = File.expand_path("~") + "/.ssh/known_hosts"
FileUtils.rm_rf(known_hosts)
end