dtk-shell 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/Gemfile_dev +13 -0
- data/README.md +121 -0
- data/bin/dtk-execute +32 -0
- data/bin/dtk-run +92 -0
- data/bin/dtk-shell +31 -0
- data/dtk-shell.gemspec +50 -0
- data/lib/auxiliary.rb +61 -0
- data/lib/bundler_monkey_patch.rb +26 -0
- data/lib/client.rb +58 -0
- data/lib/command_helper.rb +33 -0
- data/lib/command_helpers/git_repo.rb +589 -0
- data/lib/command_helpers/git_repo/merge.rb +153 -0
- data/lib/command_helpers/jenkins_client.rb +106 -0
- data/lib/command_helpers/jenkins_client/config_xml.rb +288 -0
- data/lib/command_helpers/service_importer.rb +251 -0
- data/lib/command_helpers/service_link.rb +33 -0
- data/lib/command_helpers/test_module_creator.rb +69 -0
- data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +10 -0
- data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +10 -0
- data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +5 -0
- data/lib/commands.rb +57 -0
- data/lib/commands/common/thor/access_control.rb +133 -0
- data/lib/commands/common/thor/action_result_handler.rb +74 -0
- data/lib/commands/common/thor/assembly_template.rb +92 -0
- data/lib/commands/common/thor/assembly_workspace.rb +1801 -0
- data/lib/commands/common/thor/base_command_helper.rb +59 -0
- data/lib/commands/common/thor/clone.rb +82 -0
- data/lib/commands/common/thor/common.rb +88 -0
- data/lib/commands/common/thor/common_base.rb +49 -0
- data/lib/commands/common/thor/create_target.rb +70 -0
- data/lib/commands/common/thor/edit.rb +255 -0
- data/lib/commands/common/thor/inventory_parser.rb +98 -0
- data/lib/commands/common/thor/list_diffs.rb +128 -0
- data/lib/commands/common/thor/module.rb +1011 -0
- data/lib/commands/common/thor/module/import.rb +210 -0
- data/lib/commands/common/thor/node.rb +53 -0
- data/lib/commands/common/thor/poller.rb +65 -0
- data/lib/commands/common/thor/pull_clone_changes.rb +28 -0
- data/lib/commands/common/thor/pull_from_remote.rb +152 -0
- data/lib/commands/common/thor/puppet_forge.rb +72 -0
- data/lib/commands/common/thor/purge_clone.rb +101 -0
- data/lib/commands/common/thor/push_clone_changes.rb +162 -0
- data/lib/commands/common/thor/push_to_remote.rb +94 -0
- data/lib/commands/common/thor/remotes.rb +71 -0
- data/lib/commands/common/thor/reparse.rb +40 -0
- data/lib/commands/common/thor/set_required_attributes.rb +46 -0
- data/lib/commands/thor/account.rb +239 -0
- data/lib/commands/thor/assembly.rb +356 -0
- data/lib/commands/thor/attribute.rb +79 -0
- data/lib/commands/thor/component.rb +70 -0
- data/lib/commands/thor/component_module.rb +501 -0
- data/lib/commands/thor/component_template.rb +174 -0
- data/lib/commands/thor/dependency.rb +34 -0
- data/lib/commands/thor/developer.rb +144 -0
- data/lib/commands/thor/dtk.rb +152 -0
- data/lib/commands/thor/library.rb +125 -0
- data/lib/commands/thor/node.rb +504 -0
- data/lib/commands/thor/node_template.rb +94 -0
- data/lib/commands/thor/project.rb +34 -0
- data/lib/commands/thor/provider.rb +233 -0
- data/lib/commands/thor/remotes.rb +49 -0
- data/lib/commands/thor/service.rb +941 -0
- data/lib/commands/thor/service_module.rb +914 -0
- data/lib/commands/thor/state_change.rb +25 -0
- data/lib/commands/thor/target.rb +250 -0
- data/lib/commands/thor/task.rb +116 -0
- data/lib/commands/thor/test_module.rb +310 -0
- data/lib/commands/thor/utils.rb +21 -0
- data/lib/commands/thor/workspace.rb +685 -0
- data/lib/config/cacert.pem +3785 -0
- data/lib/config/client.conf.header +20 -0
- data/lib/config/configuration.rb +99 -0
- data/lib/config/default.conf +16 -0
- data/lib/config/disk_cacher.rb +80 -0
- data/lib/configurator.rb +176 -0
- data/lib/context_router.rb +44 -0
- data/lib/core.rb +497 -0
- data/lib/domain/git_adapter.rb +412 -0
- data/lib/domain/git_error_handler.rb +64 -0
- data/lib/domain/response.rb +285 -0
- data/lib/domain/response/error_handler.rb +86 -0
- data/lib/dtk-shell/version.rb +20 -0
- data/lib/dtk_constants.rb +40 -0
- data/lib/dtk_error.rb +114 -0
- data/lib/dtk_logger.rb +126 -0
- data/lib/dtk_shell.rb +31 -0
- data/lib/error.rb +85 -0
- data/lib/execute.rb +29 -0
- data/lib/execute/cli_pure/cli_rerouter.rb +102 -0
- data/lib/execute/command.rb +40 -0
- data/lib/execute/command/api_call.rb +60 -0
- data/lib/execute/command/api_call/map.rb +60 -0
- data/lib/execute/command/api_call/service.rb +91 -0
- data/lib/execute/command/api_call/translation_term.rb +119 -0
- data/lib/execute/command/rest_call.rb +37 -0
- data/lib/execute/command_processor.rb +30 -0
- data/lib/execute/command_processor/rest_call.rb +59 -0
- data/lib/execute/error_usage.rb +21 -0
- data/lib/execute/execute_context.rb +86 -0
- data/lib/execute/execute_context/result_store.rb +37 -0
- data/lib/execute/script.rb +64 -0
- data/lib/execute/script/add_tenant.rb +121 -0
- data/lib/git-logs/git.log +0 -0
- data/lib/parser/adapters/option_parser.rb +70 -0
- data/lib/parser/adapters/thor.rb +555 -0
- data/lib/parser/adapters/thor/common_option_defs.rb +40 -0
- data/lib/require_first.rb +104 -0
- data/lib/search_hash.rb +44 -0
- data/lib/shell.rb +261 -0
- data/lib/shell/context.rb +1065 -0
- data/lib/shell/context_aux.rb +46 -0
- data/lib/shell/domain/active_context.rb +186 -0
- data/lib/shell/domain/context_entity.rb +89 -0
- data/lib/shell/domain/context_params.rb +223 -0
- data/lib/shell/domain/override_tasks.rb +88 -0
- data/lib/shell/domain/shadow_entity.rb +76 -0
- data/lib/shell/header_shell.rb +44 -0
- data/lib/shell/help_monkey_patch.rb +283 -0
- data/lib/shell/interactive_wizard.rb +225 -0
- data/lib/shell/message_queue.rb +63 -0
- data/lib/shell/parse_monkey_patch.rb +39 -0
- data/lib/shell/status_monitor.rb +124 -0
- data/lib/task_status.rb +83 -0
- data/lib/task_status/refresh_mode.rb +77 -0
- data/lib/task_status/snapshot_mode.rb +28 -0
- data/lib/task_status/stream_mode.rb +48 -0
- data/lib/task_status/stream_mode/element.rb +101 -0
- data/lib/task_status/stream_mode/element/format.rb +101 -0
- data/lib/task_status/stream_mode/element/hierarchical_task.rb +100 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result.rb +72 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/action.rb +93 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/components.rb +26 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/result/node_level.rb +26 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps.rb +34 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/action.rb +53 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/components.rb +53 -0
- data/lib/task_status/stream_mode/element/hierarchical_task/steps/node_level.rb +42 -0
- data/lib/task_status/stream_mode/element/no_results.rb +26 -0
- data/lib/task_status/stream_mode/element/render.rb +59 -0
- data/lib/task_status/stream_mode/element/stage.rb +84 -0
- data/lib/task_status/stream_mode/element/stage/render.rb +76 -0
- data/lib/task_status/stream_mode/element/task_end.rb +35 -0
- data/lib/task_status/stream_mode/element/task_start.rb +37 -0
- data/lib/util/common_util.rb +37 -0
- data/lib/util/console.rb +235 -0
- data/lib/util/dtk_puppet.rb +65 -0
- data/lib/util/module_util.rb +66 -0
- data/lib/util/os_util.rb +385 -0
- data/lib/util/permission_util.rb +31 -0
- data/lib/util/remote_dependency_util.rb +84 -0
- data/lib/util/ssh_util.rb +94 -0
- data/lib/view_processor.rb +129 -0
- data/lib/view_processor/augmented_simple_list.rb +44 -0
- data/lib/view_processor/hash_pretty_print.rb +123 -0
- data/lib/view_processor/simple_list.rb +156 -0
- data/lib/view_processor/table_print.rb +309 -0
- data/lib/violation.rb +86 -0
- data/lib/violation/attribute.rb +76 -0
- data/lib/violation/fix.rb +26 -0
- data/lib/violation/fix/result.rb +73 -0
- data/lib/violation/fix/result/error.rb +34 -0
- data/lib/violation/fix/set_attribute.rb +41 -0
- data/lib/violation/sub_classes.rb +60 -0
- data/puppet/manifests/init.pp +72 -0
- data/puppet/manifests/params.pp +16 -0
- data/puppet/r8meta.puppet.yml +35 -0
- data/puppet/templates/bash_profile.erb +2 -0
- data/puppet/templates/client.conf.erb +1 -0
- data/puppet/templates/dtkclient.erb +2 -0
- data/spec/component_module_spec.rb +34 -0
- data/spec/dependency_spec.rb +6 -0
- data/spec/dtk_shell_spec.rb +13 -0
- data/spec/dtk_spec.rb +33 -0
- data/spec/lib/spec_helper.rb +10 -0
- data/spec/lib/spec_thor.rb +108 -0
- data/spec/node_template_spec.rb +24 -0
- data/spec/project_spec.rb +6 -0
- data/spec/repo_spec.rb +7 -0
- data/spec/response_spec.rb +52 -0
- data/spec/service_module_spec.rb +38 -0
- data/spec/service_spec.rb +50 -0
- data/spec/state_change_spec.rb +7 -0
- data/spec/table_print_spec.rb +48 -0
- data/spec/target_spec.rb +57 -0
- data/spec/task_spec.rb +28 -0
- data/views/assembly/augmented_simple_list.rb +12 -0
- data/views/assembly_template/augmented_simple_list.rb +12 -0
- data/views/list_task/augmented_simple_list.rb +12 -0
- metadata +421 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
class dtk_client::params()
|
2
|
+
{
|
3
|
+
$client_user = 'dtk-client'
|
4
|
+
$dtk_username = 'joe'
|
5
|
+
$dtk_password = 'r8server'
|
6
|
+
$client_user_homedir = "/home/${client_user}"
|
7
|
+
$repos = ['client','common']
|
8
|
+
$repo_urls = {
|
9
|
+
'client' => 'git@github.com:rich-reactor8/dtk-client.git',
|
10
|
+
'common' => 'git@github.com:rich-reactor8/dtk-common.git'
|
11
|
+
}
|
12
|
+
$repo_targets = {
|
13
|
+
'client' => 'src',
|
14
|
+
'common' => 'common'
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2010-2016 dtk contributors
|
3
|
+
#
|
4
|
+
# This file is part of the dtk project.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
--- !omap
|
19
|
+
- dtk_client: !omap
|
20
|
+
- display_name: dtk_client
|
21
|
+
- description: DTK client
|
22
|
+
- external_ref:
|
23
|
+
class_name: dtk_client
|
24
|
+
type: puppet_class
|
25
|
+
- basic_type: service
|
26
|
+
- component_type: dtk_client
|
27
|
+
- attribute: !omap
|
28
|
+
- server_hostname: !omap
|
29
|
+
- display_name: server_hostname
|
30
|
+
- description: DTK server hostname
|
31
|
+
- data_type: string
|
32
|
+
- required: true
|
33
|
+
- external_ref:
|
34
|
+
type: puppet_attribute
|
35
|
+
path: node[dtk_client][server_hostname]
|
@@ -0,0 +1 @@
|
|
1
|
+
server_host = <%= server_hostname %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/component_module', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::ComponentModule do
|
8
|
+
$component_module_id = nil
|
9
|
+
|
10
|
+
context '#list' do
|
11
|
+
$component_module_list = run_from_dtk_shell('component-module list')
|
12
|
+
|
13
|
+
it "should have component module listing" do
|
14
|
+
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
15
|
+
end
|
16
|
+
|
17
|
+
unless $component_module_list.nil?
|
18
|
+
unless $component_module_list['data'].nil?
|
19
|
+
$component_module_id = $component_module_list['data'].first['id'] unless $component_module_list['data'].empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "#list/command" do
|
25
|
+
unless $component_module_id.nil?
|
26
|
+
output = run_from_dtk_shell("component-module #{$component_module_id} list-components")
|
27
|
+
|
28
|
+
it "should list all components for component module with id #{$component_module_id}" do
|
29
|
+
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.expand_path('../lib/shell', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe DTK::Shell do
|
4
|
+
|
5
|
+
# generic test for all task of Thor class
|
6
|
+
#test_task_interface(DTK::Client::Task)
|
7
|
+
|
8
|
+
init_shell_context()
|
9
|
+
|
10
|
+
line = 'cc /service'
|
11
|
+
execute_shell_command(line,'')
|
12
|
+
|
13
|
+
end
|
data/spec/dtk_spec.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
include SpecThor
|
5
|
+
|
6
|
+
describe DTK::Client::Dtk do
|
7
|
+
|
8
|
+
# generic test for all task of Thor class
|
9
|
+
#test_task_interface(DTK::Client::Dtk)
|
10
|
+
|
11
|
+
context "Dtk CLI command" do
|
12
|
+
|
13
|
+
f = IO.popen('dtk')
|
14
|
+
output = f.readlines.join('')
|
15
|
+
|
16
|
+
it "should have service listing" do
|
17
|
+
output.should match(/(dtk|service|ok|status|empty|INFO|WARNING)/)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have node listing" do
|
21
|
+
output.should match(/(dtk|node|ok|status|empty|INFO|WARNING)/)
|
22
|
+
end
|
23
|
+
|
24
|
+
# it "should have repo listing" do
|
25
|
+
# output.should include("dtk repo")
|
26
|
+
# end
|
27
|
+
|
28
|
+
it "should have task listing" do
|
29
|
+
output.should match(/(dtk|task|ok|status|empty|INFO|WARNING)/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
# Use color in STDOUT
|
3
|
+
config.color_enabled = true
|
4
|
+
|
5
|
+
# Use color not only in STDOUT but also in pagers and files
|
6
|
+
config.tty = true
|
7
|
+
|
8
|
+
# Use the specified formatter
|
9
|
+
#config.formatter = :documentation # :progress, :html, :textmate
|
10
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require File.expand_path('../../lib/client', File.dirname(__FILE__))
|
2
|
+
require File.expand_path('../../lib/parser/adapters/thor', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../../lib/shell/context', File.dirname(__FILE__))
|
4
|
+
require File.expand_path('../../lib/shell/domain/context_entity', File.dirname(__FILE__))
|
5
|
+
require File.expand_path('../../lib/shell/domain/active_context', File.dirname(__FILE__))
|
6
|
+
require File.expand_path('../../lib/shell/domain/context_params', File.dirname(__FILE__))
|
7
|
+
require File.expand_path('../../lib/shell/domain/override_tasks', File.dirname(__FILE__))
|
8
|
+
Dir[File.expand_path('../../lib/shell/parse_monkey_patch.rb', File.dirname(__FILE__))].each {|file| require file }
|
9
|
+
|
10
|
+
require 'shellwords'
|
11
|
+
require 'rspec'
|
12
|
+
|
13
|
+
module SpecThor
|
14
|
+
|
15
|
+
include DTK::Client::Auxiliary
|
16
|
+
|
17
|
+
def run_from_dtk_shell(line)
|
18
|
+
args = Shellwords.split(line)
|
19
|
+
cmd = args.shift
|
20
|
+
conn = DTK::Client::Session.get_connection()
|
21
|
+
|
22
|
+
# special case for when no params are provided use help method
|
23
|
+
if (cmd == 'help' || cmd.nil?)
|
24
|
+
cmd = 'dtk'
|
25
|
+
args = ['help']
|
26
|
+
end
|
27
|
+
|
28
|
+
context = DTK::Shell::Context.new(true)
|
29
|
+
|
30
|
+
entity_name, method_name, hashed_argv, options_args = context.get_dtk_command_parameters(cmd, args)
|
31
|
+
entity_class = DTK::Client.const_get "#{cap_form(entity_name)}"
|
32
|
+
|
33
|
+
return entity_class.execute_from_cli(conn,method_name,hashed_argv,options_args,true)
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Capturing stream and returning string
|
38
|
+
def capture(stream)
|
39
|
+
begin
|
40
|
+
stream = stream.to_s
|
41
|
+
eval "$#{stream} = StringIO.new"
|
42
|
+
yield
|
43
|
+
result = eval("$#{stream}").string
|
44
|
+
ensure
|
45
|
+
eval("$#{stream} = #{stream.upcase}")
|
46
|
+
end
|
47
|
+
|
48
|
+
result
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Method work with classes that inherit Thor class. Method will take each task
|
53
|
+
# and just run it to check for any errors. In this case internal error.
|
54
|
+
def test_task_interface(clazz)
|
55
|
+
|
56
|
+
# this will stop buffering of print method, for proper output
|
57
|
+
# STDOUT.sync = true
|
58
|
+
|
59
|
+
clazz.all_tasks.each do |a,task|
|
60
|
+
context "#{clazz.name} CLI command (#{task.name})" do
|
61
|
+
|
62
|
+
# e.g. shell execute: dtk assembly list
|
63
|
+
command = "dtk #{get_task_name(clazz.name)} #{task.name}"
|
64
|
+
|
65
|
+
print ">> Surface test for #{command} ... "
|
66
|
+
|
67
|
+
output = `#{command}`
|
68
|
+
|
69
|
+
it "should not have errors." do
|
70
|
+
output.should_not include("[INTERNAL ERROR]")
|
71
|
+
end
|
72
|
+
|
73
|
+
# test finished (print OK! in green color)
|
74
|
+
puts "\e[32mOK!\e[0m"
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
# Redirects stderr and stdout to /dev/null.
|
82
|
+
def silence_output
|
83
|
+
$stderr = File.new('/dev/null', 'w')
|
84
|
+
$stdout = File.new('/dev/null', 'w')
|
85
|
+
end
|
86
|
+
|
87
|
+
# Replace stdout and stderr so anything else is output correctly.
|
88
|
+
def enable_output
|
89
|
+
$stderr = STDOUT
|
90
|
+
$stdout = STDERR
|
91
|
+
end
|
92
|
+
|
93
|
+
def unindent(num=nil)
|
94
|
+
regex = num ? /^\s{#{num}}/ : /^\s*/
|
95
|
+
gsub(regex, '').chomp
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
##
|
101
|
+
# Method will take task name from class name
|
102
|
+
# e.g. DTK::Client::Assembly => assembly
|
103
|
+
def get_task_name(clazz_name)
|
104
|
+
snake_form(clazz_name.split('::').last).downcase
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/node_template', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::NodeTemplate do
|
8
|
+
$node_template_id = nil
|
9
|
+
|
10
|
+
context '#list' do
|
11
|
+
$node_template_list = run_from_dtk_shell('node-template list')
|
12
|
+
|
13
|
+
it "should have node-template listing" do
|
14
|
+
$node_template_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
15
|
+
end
|
16
|
+
|
17
|
+
unless $node_template_list.nil?
|
18
|
+
unless $node_template_list['data'].nil?
|
19
|
+
$node_template_id = $node_template_list['data'].first['id'] unless $node_template_list['data'].empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/repo_spec.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
include SpecThor
|
5
|
+
|
6
|
+
describe DTK::Client::Response do
|
7
|
+
# before{
|
8
|
+
# @hash = {"data"=>[{"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147507731, "nodes"=>[{"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::datanode", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib"], "node_id"=>2147507717, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147507725, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::R8-C5-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506303, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147506290, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506296, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-CS-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506141, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506134, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-CS-HADOOP_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505988, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505961, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp", "hdp-hbase::zk-conn", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505978, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505973, "node_name"=>"HBASE-ZK"}], "display_name"=>"abh::R8-CS-HBASE"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147506008, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505996, "node_name"=>"HBASE-slave01"}], "display_name"=>"abh::R8-CS-HBASE_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505734, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505728, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505723, "node_name"=>"HDFS-NN"}], "display_name"=>"abh::R8-CS-HDFS"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505743, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505737, "node_name"=>"HDFS-slave01"}], "display_name"=>"abh::R8-CS-HDFS_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505230, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505224, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505217, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-RH-HADOOP"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505240, "nodes"=>[{"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505233, "node_name"=>"HADOOP-slave01"}], "display_name"=>"abh::R8-RH-HADOOP_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505617, "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505612, "node_name"=>"HBASE-ZK"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505590, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505602, "node_name"=>"HBASE-NN-JT-HM"}], "display_name"=>"abh::R8-RH-HBASE"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505637, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505625, "node_name"=>"HBASE-slave01"}], "display_name"=>"abh::R8-RH-HBASE_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505200, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505194, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505189, "node_name"=>"HDFS-NN"}], "display_name"=>"abh::R8-RH-HDFS"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147505356, "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib"], "node_id"=>2147505350, "node_name"=>"HDFS-slave01"}], "display_name"=>"abh::R8-RH-HDFS_slave"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508641, "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508634, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508627, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::centos_hadoop_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508533, "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508519, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::jobtracker", "hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib"], "node_id"=>2147508526, "node_name"=>"HADOOP-NN-JT"}], "display_name"=>"abh::hadoop_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147508831, "nodes"=>[{"components"=>["hdp-hbase::master-conn", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hbase::regionserver"], "node_id"=>2147508819, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp-hadoop::smoketest_hdfs", "hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508808, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp-zookeeper", "hdp", "stdlib"], "node_id"=>2147508803, "node_name"=>"HBASE-ZK"}], "display_name"=>"abh::hbase_centos_smoke"}, {"execution_status"=>nil, "module_branch_id"=>2147485695, "id"=>2147493292, "nodes"=>[{"components"=>["hdp-hadoop::namenode", "hdp-hbase::master", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hbase::zk-conn"], "node_id"=>2147493278, "node_name"=>"master"}, {"components"=>["stdlib", "hdp-hadoop::namenode-conn", "hdp-hbase::regionserver", "hdp-hbase::master-conn", "hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-zookeeper", "hdp"], "node_id"=>2147493259, "node_name"=>"slave"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::client", "hdp-hadoop::smoketest_hdfs", "hdp", "stdlib"], "node_id"=>2147493271, "node_name"=>"client"}], "display_name"=>"abh::smoke"}], "status"=>"ok"}
|
9
|
+
# # @response = DTK::Client::Response.new(:assembly, @hash)
|
10
|
+
|
11
|
+
# # @response.render_table(:assembly)
|
12
|
+
# # @a = @response.render_data.to_s
|
13
|
+
# }
|
14
|
+
|
15
|
+
# it "render_table" do
|
16
|
+
|
17
|
+
# expected_table = <<-TABLE.unindent
|
18
|
+
# +------------+--------------------------+--------+-------+------------+
|
19
|
+
# | id | assembly_name | status | nodes | components |
|
20
|
+
# +------------+--------------------------+--------+-------+------------+
|
21
|
+
# | 2147507731 | abh::R8-C5-HADOOP | | 2 | |
|
22
|
+
# | 2147506303 | abh::R8-CS-HADOOP | | 2 | |
|
23
|
+
# | 2147506141 | abh::R8-CS-HADOOP_slave | | 1 | |
|
24
|
+
# | 2147505988 | abh::R8-CS-HBASE | | 3 | |
|
25
|
+
# | 2147506008 | abh::R8-CS-HBASE_slave | | 1 | |
|
26
|
+
# | 2147505734 | abh::R8-CS-HDFS | | 2 | |
|
27
|
+
# | 2147505743 | abh::R8-CS-HDFS_slave | | 1 | |
|
28
|
+
# | 2147505230 | abh::R8-RH-HADOOP | | 2 | |
|
29
|
+
# | 2147505240 | abh::R8-RH-HADOOP_slave | | 1 | |
|
30
|
+
# | 2147505617 | abh::R8-RH-HBASE | | 3 | |
|
31
|
+
# | 2147505637 | abh::R8-RH-HBASE_slave | | 1 | |
|
32
|
+
# | 2147505200 | abh::R8-RH-HDFS | | 2 | |
|
33
|
+
# | 2147505356 | abh::R8-RH-HDFS_slave | | 1 | |
|
34
|
+
# | 2147508641 | abh::centos_hadoop_smoke | | 2 | |
|
35
|
+
# | 2147508533 | abh::hadoop_smoke | | 2 | |
|
36
|
+
# | 2147508831 | abh::hbase_centos_smoke | | 3 | |
|
37
|
+
# | 2147493292 | abh::smoke | | 3 | |
|
38
|
+
# +------------+--------------------------+--------+-------+------------+
|
39
|
+
|
40
|
+
# 17 rows in set
|
41
|
+
# TABLE
|
42
|
+
|
43
|
+
# @data = [{"execution_status"=>nil, "id"=>2147507731, "display_name"=>"abh::R8-C5-HADOOP", "nodes"=>[{"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::datanode", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib"], "node_id"=>2147507717, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147507725, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506303, "display_name"=>"abh::R8-CS-HADOOP", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147506290, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506296, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506141, "display_name"=>"abh::R8-CS-HADOOP_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147506134, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505988, "display_name"=>"abh::R8-CS-HBASE", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505961, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp", "hdp-hbase::zk-conn", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505978, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505973, "node_name"=>"HBASE-ZK"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147506008, "display_name"=>"abh::R8-CS-HBASE_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505996, "node_name"=>"HBASE-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505734, "display_name"=>"abh::R8-CS-HDFS", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505728, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505723, "node_name"=>"HDFS-NN"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505743, "display_name"=>"abh::R8-CS-HDFS_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505737, "node_name"=>"HDFS-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505230, "display_name"=>"abh::R8-RH-HADOOP", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505224, "node_name"=>"HADOOP-NN-JT"}, {"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505217, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505240, "display_name"=>"abh::R8-RH-HADOOP_slave", "nodes"=>[{"components"=>["hdp-hadoop::datanode", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hadoop::tasktracker"], "node_id"=>2147505233, "node_name"=>"HADOOP-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505617, "display_name"=>"abh::R8-RH-HBASE", "nodes"=>[{"components"=>["hdp", "stdlib", "hdp-zookeeper"], "node_id"=>2147505612, "node_name"=>"HBASE-ZK"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505590, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hadoop::namenode"], "node_id"=>2147505602, "node_name"=>"HBASE-NN-JT-HM"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505637, "display_name"=>"abh::R8-RH-HBASE_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hbase::zk-conn", "hdp-hadoop::datanode", "hdp", "stdlib", "hdp-hbase::regionserver", "hdp-hadoop::tasktracker", "hdp-hbase::master-conn"], "node_id"=>2147505625, "node_name"=>"HBASE-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505200, "display_name"=>"abh::R8-RH-HDFS", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp", "hdp-hadoop::datanode", "stdlib"], "node_id"=>2147505194, "node_name"=>"HDFS-slave01"}, {"components"=>["hdp", "stdlib", "hdp-hadoop::namenode"], "node_id"=>2147505189, "node_name"=>"HDFS-NN"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147505356, "display_name"=>"abh::R8-RH-HDFS_slave", "nodes"=>[{"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::datanode", "hdp", "stdlib"], "node_id"=>2147505350, "node_name"=>"HDFS-slave01"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508641, "display_name"=>"abh::centos_hadoop_smoke", "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508634, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508627, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508533, "display_name"=>"abh::hadoop_smoke", "nodes"=>[{"components"=>["hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-hadoop::namenode-conn", "hdp", "stdlib"], "node_id"=>2147508519, "node_name"=>"HADOOP-slave01"}, {"components"=>["hdp-hadoop::jobtracker", "hdp-hadoop::smoketest_hdfs", "hdp-hadoop::namenode", "hdp", "stdlib"], "node_id"=>2147508526, "node_name"=>"HADOOP-NN-JT"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147508831, "display_name"=>"abh::hbase_centos_smoke", "nodes"=>[{"components"=>["hdp-hbase::master-conn", "hdp-hadoop::datanode", "hdp-hbase::zk-conn", "hdp-hadoop::tasktracker", "hdp", "hdp-hadoop::namenode-conn", "stdlib", "hdp-hbase::regionserver"], "node_id"=>2147508819, "node_name"=>"HBASE-slave01"}, {"components"=>["hdp-hadoop::namenode", "hdp-hadoop::smoketest_hdfs", "hdp-hbase::master", "hdp-hbase::zk-conn", "hdp", "stdlib", "hdp-hadoop::jobtracker"], "node_id"=>2147508808, "node_name"=>"HBASE-NN-JT-HM"}, {"components"=>["hdp-zookeeper", "hdp", "stdlib"], "node_id"=>2147508803, "node_name"=>"HBASE-ZK"}], "module_branch_id"=>2147485695}, {"execution_status"=>nil, "id"=>2147493292, "display_name"=>"abh::smoke", "nodes"=>[{"components"=>["hdp-hadoop::namenode", "hdp-hbase::master", "hdp", "stdlib", "hdp-hadoop::jobtracker", "hdp-hbase::zk-conn"], "node_id"=>2147493278, "node_name"=>"master"}, {"components"=>["stdlib", "hdp-hadoop::namenode-conn", "hdp-hbase::regionserver", "hdp-hbase::master-conn", "hdp-hadoop::tasktracker", "hdp-hadoop::datanode", "hdp-zookeeper", "hdp"], "node_id"=>2147493259, "node_name"=>"slave"}, {"components"=>["hdp-hadoop::namenode-conn", "hdp-hadoop::client", "hdp-hadoop::smoketest_hdfs", "hdp", "stdlib"], "node_id"=>2147493271, "node_name"=>"client"}], "module_branch_id"=>2147485695}]
|
44
|
+
# @command_clazz = :assembly
|
45
|
+
# @data_type_clazz = "ASSEMBLY"
|
46
|
+
|
47
|
+
# @a = DTK::Client::ViewProcTablePrint.new("table_print", :assembly)
|
48
|
+
# @a.render(@data, @command_clazz, @data_type_clazz)
|
49
|
+
# end
|
50
|
+
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/service_module', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::ServiceModule do
|
8
|
+
$about = ['assemblies']
|
9
|
+
$service_module_id = nil
|
10
|
+
|
11
|
+
context '#list' do
|
12
|
+
$service_module_list = run_from_dtk_shell('service-module list')
|
13
|
+
|
14
|
+
it "should have service modules listing" do
|
15
|
+
$service_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
16
|
+
end
|
17
|
+
|
18
|
+
unless $service_module_list.nil?
|
19
|
+
unless $service_module_list['data'].nil?
|
20
|
+
$service_module_id = $service_module_list['data'].first['id'] unless $service_module_list['data'].empty?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "#list/command" do
|
26
|
+
unless $service_module_id.nil?
|
27
|
+
$about.each do |type|
|
28
|
+
output = run_from_dtk_shell("service-module #{$service_module_id} list #{type}")
|
29
|
+
|
30
|
+
it "should list all #{type} for service module with id #{$service_module_id}" do
|
31
|
+
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/assembly', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::Assembly do
|
8
|
+
$about = ['nodes', 'components', 'attributes','tasks']
|
9
|
+
$service_id = nil
|
10
|
+
|
11
|
+
#list all services and take one service_id
|
12
|
+
context "#list" do
|
13
|
+
$service_list = run_from_dtk_shell('service list')
|
14
|
+
|
15
|
+
it "should have service listing" do
|
16
|
+
$service_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
17
|
+
end
|
18
|
+
|
19
|
+
unless $service_list.nil?
|
20
|
+
unless $service_list['data'].nil?
|
21
|
+
$service_id = $service_list['data'].first['id'] unless $service_list['data'].empty?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# for previously taken service_id, do list nodes|components|tasks
|
27
|
+
context "#list/command" do
|
28
|
+
unless $service_id.nil?
|
29
|
+
$about.each do |type|
|
30
|
+
output = run_from_dtk_shell("service #{$service_id} list #{type}")
|
31
|
+
|
32
|
+
it "should list all #{type} for service with id #{$service_id}" do
|
33
|
+
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# for previously taken service_id, do info
|
40
|
+
context "#info" do
|
41
|
+
unless $service_id.nil?
|
42
|
+
output = run_from_dtk_shell("service #{$service_id} info")
|
43
|
+
|
44
|
+
it "should show information about service with id #{$service_id}" do
|
45
|
+
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|