rhc 0.97.17 → 0.98.16
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rhc +9 -9
- data/bin/rhc-port-forward +3 -0
- data/bin/rhc-sshkey +3 -0
- data/features/README.md +163 -35
- data/features/application.feature +24 -0
- data/features/cartridge.feature +24 -0
- data/features/client.feature +11 -0
- data/features/domain.feature +29 -0
- data/features/lib/rhc_helper.rb +14 -0
- data/features/lib/rhc_helper/app.rb +2 -8
- data/features/lib/rhc_helper/cartridge.rb +1 -7
- data/features/lib/rhc_helper/commandify.rb +37 -6
- data/features/lib/rhc_helper/domain.rb +5 -1
- data/features/lib/rhc_helper/httpify.rb +124 -60
- data/features/lib/rhc_helper/loggable.rb +0 -2
- data/features/lib/rhc_helper/persistable.rb +12 -2
- data/features/lib/rhc_helper/sshkey.rb +29 -0
- data/features/multiple_cartridge.feature +17 -0
- data/features/sshkey.feature +58 -0
- data/features/step_definitions/application_steps.rb +60 -52
- data/features/step_definitions/cartridge_steps.rb +22 -24
- data/features/step_definitions/client_steps.rb +9 -2
- data/features/step_definitions/domain_steps.rb +4 -0
- data/features/step_definitions/sshkey_steps.rb +56 -0
- data/features/support/assumptions.rb +37 -0
- data/features/support/before_hooks.rb +25 -0
- data/features/support/env.rb +84 -39
- data/features/support/key1 +27 -0
- data/features/support/key1.pub +1 -0
- data/features/support/key2 +27 -0
- data/features/support/key2.pub +1 -0
- data/features/support/key3.pub +1 -0
- data/features/support/ssh.sh +2 -0
- data/features/verify.feature +18 -159
- data/lib/rhc-common.rb +8 -21
- data/lib/rhc.rb +9 -5
- data/lib/rhc/autocomplete.rb +68 -0
- data/lib/rhc/autocomplete_templates/rhc.erb +33 -0
- data/lib/rhc/cli.rb +9 -6
- data/lib/rhc/command_runner.rb +108 -0
- data/lib/rhc/commands.rb +66 -132
- data/lib/rhc/commands/base.rb +95 -24
- data/lib/rhc/commands/domain.rb +33 -50
- data/lib/rhc/commands/port-forward.rb +81 -0
- data/lib/rhc/commands/setup.rb +1 -1
- data/lib/rhc/commands/sshkey.rb +95 -0
- data/lib/rhc/config.rb +108 -103
- data/lib/rhc/context_helper.rb +19 -0
- data/lib/rhc/coverage_helper.rb +1 -1
- data/lib/rhc/exceptions.rb +55 -4
- data/lib/rhc/help_formatter.rb +2 -3
- data/lib/rhc/helpers.rb +31 -23
- data/lib/{rhc-rest.rb → rhc/rest.rb} +95 -23
- data/lib/{rhc-rest → rhc/rest}/application.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/cartridge.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/client.rb +40 -9
- data/lib/{rhc-rest → rhc/rest}/domain.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/key.rb +11 -1
- data/lib/{rhc-rest → rhc/rest}/user.rb +1 -1
- data/lib/rhc/ssh_key_helpers.rb +10 -1
- data/lib/rhc/targz.rb +7 -8
- data/lib/rhc/usage_templates/command_help.erb +7 -6
- data/lib/rhc/usage_templates/help.erb +6 -9
- data/lib/rhc/usage_templates/missing_help.erb +1 -0
- data/lib/rhc/version.rb +2 -2
- data/lib/rhc/wizard.rb +4 -9
- data/spec/coverage_helper.rb +2 -2
- data/spec/rest_spec_helper.rb +66 -16
- data/spec/rhc/cli_spec.rb +16 -5
- data/spec/rhc/command_spec.rb +61 -6
- data/spec/rhc/commands/domain_spec.rb +50 -27
- data/spec/rhc/commands/port-forward_spec.rb +133 -0
- data/spec/rhc/commands/setup_spec.rb +2 -2
- data/spec/rhc/commands/sshkey_spec.rb +141 -0
- data/spec/rhc/common_spec.rb +1 -1
- data/spec/rhc/config_spec.rb +6 -4
- data/spec/rhc/helpers_spec.rb +0 -21
- data/spec/rhc/rest_application_spec.rb +7 -7
- data/spec/rhc/rest_client_spec.rb +87 -24
- data/spec/rhc/rest_spec.rb +36 -36
- data/spec/rhc/wizard_spec.rb +3 -3
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +3 -3
- metadata +61 -31
- data/lib/rhc-rest/exceptions/exceptions.rb +0 -75
- data/test/functional/application_test.rb +0 -71
- data/test/functional/domain_test.rb +0 -123
- data/test/functional/test_credentials.rb +0 -5
- data/test/sample-usage.rb +0 -122
- data/test/support/server.rb +0 -14
- data/test/support/testcase.rb +0 -3
- data/test/test_helper.rb +0 -4
- data/test/unit/command_test.rb +0 -19
data/spec/rhc/wizard_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe RHC::Wizard do
|
|
22
22
|
it "should print out first run greeting" do
|
23
23
|
@wizard.run_next_stage
|
24
24
|
greeting = $terminal.read
|
25
|
-
greeting.count("\n").should
|
25
|
+
greeting.count("\n").should >= 7
|
26
26
|
greeting.should match(Regexp.escape("It looks like you have not configured or used OpenShift client tools on this computer."))
|
27
27
|
greeting.should match(Regexp.escape("\n#{@wizard.config_path}\n"))
|
28
28
|
end
|
@@ -719,7 +719,7 @@ describe RHC::Wizard do
|
|
719
719
|
end
|
720
720
|
|
721
721
|
def add_domain(domain_name)
|
722
|
-
raise
|
722
|
+
raise RHC::Rest::ValidationException.new("Error: domain name should be '#{@domain_name}' but got '#{domain_name}'") if domain_name != @domain_name
|
723
723
|
|
724
724
|
MockDomain.new(domain_name)
|
725
725
|
end
|
@@ -748,7 +748,7 @@ describe RHC::Wizard do
|
|
748
748
|
end
|
749
749
|
|
750
750
|
def stub_rhc_client_new
|
751
|
-
|
751
|
+
RHC::Rest::Client.stub(:new) do |end_point, name, password|
|
752
752
|
MockRestApi.new(end_point, name, password)
|
753
753
|
end
|
754
754
|
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ class FakeFS::File
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# Epic fail - FakeFS manages to redefine this to '/'
|
14
|
-
PATH_SEPARATOR
|
14
|
+
const_set('PATH_SEPARATOR', ":")
|
15
15
|
|
16
16
|
def self.executable?(path)
|
17
17
|
# if the file exists we will assume it is executable
|
@@ -44,11 +44,11 @@ module ClassSpecHelpers
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
def new_command_runner *args, &block
|
47
|
-
Commander::Runner.instance_variable_set :"@singleton", RHC::
|
47
|
+
Commander::Runner.instance_variable_set :"@singleton", RHC::CommandRunner.new(args)
|
48
48
|
program :name, 'test'
|
49
49
|
program :version, '1.2.3'
|
50
50
|
program :description, 'something'
|
51
|
-
program :help_formatter, RHC::
|
51
|
+
program :help_formatter, RHC::HelpFormatter
|
52
52
|
|
53
53
|
#create_test_command
|
54
54
|
yield if block
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 439
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 98
|
9
|
+
- 16
|
10
|
+
version: 0.98.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-09-17 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,10 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 25
|
30
30
|
segments:
|
31
|
+
- 2
|
31
32
|
- 0
|
32
|
-
|
33
|
+
- 11
|
34
|
+
version: 2.0.11
|
33
35
|
type: :runtime
|
34
36
|
version_requirements: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
@@ -258,20 +260,19 @@ extensions: []
|
|
258
260
|
extra_rdoc_files: []
|
259
261
|
|
260
262
|
files:
|
261
|
-
- lib/rhc-rest/client.rb
|
262
|
-
- lib/rhc-rest/exceptions/exceptions.rb
|
263
|
-
- lib/rhc-rest/domain.rb
|
264
|
-
- lib/rhc-rest/user.rb
|
265
|
-
- lib/rhc-rest/cartridge.rb
|
266
|
-
- lib/rhc-rest/key.rb
|
267
|
-
- lib/rhc-rest/application.rb
|
268
263
|
- lib/rhc.rb
|
269
|
-
- lib/rhc
|
264
|
+
- lib/rhc/autocomplete.rb
|
270
265
|
- lib/rhc/version.rb
|
271
266
|
- lib/rhc/ssh_key_helpers.rb
|
272
267
|
- lib/rhc/client.rb
|
273
268
|
- lib/rhc/exceptions.rb
|
274
269
|
- lib/rhc/cli.rb
|
270
|
+
- lib/rhc/rest/client.rb
|
271
|
+
- lib/rhc/rest/domain.rb
|
272
|
+
- lib/rhc/rest/user.rb
|
273
|
+
- lib/rhc/rest/cartridge.rb
|
274
|
+
- lib/rhc/rest/key.rb
|
275
|
+
- lib/rhc/rest/application.rb
|
275
276
|
- lib/rhc/wizard.rb
|
276
277
|
- lib/rhc/targz.rb
|
277
278
|
- lib/rhc/commands.rb
|
@@ -282,29 +283,29 @@ files:
|
|
282
283
|
- lib/rhc/vendor/parseconfig.rb
|
283
284
|
- lib/rhc/vendor/sshkey.rb
|
284
285
|
- lib/rhc/vendor/okjson.rb
|
286
|
+
- lib/rhc/command_runner.rb
|
287
|
+
- lib/rhc/context_helper.rb
|
288
|
+
- lib/rhc/rest.rb
|
285
289
|
- lib/rhc/commands/base.rb
|
286
290
|
- lib/rhc/commands/setup.rb
|
291
|
+
- lib/rhc/commands/port-forward.rb
|
287
292
|
- lib/rhc/commands/domain.rb
|
293
|
+
- lib/rhc/commands/sshkey.rb
|
288
294
|
- lib/rhc/commands/server.rb
|
289
295
|
- lib/rhc/helpers.rb
|
290
296
|
- lib/rhc/config.rb
|
291
297
|
- lib/rhc/coverage_helper.rb
|
292
298
|
- lib/rhc-common.rb
|
299
|
+
- lib/rhc/usage_templates/missing_help.erb
|
293
300
|
- lib/rhc/usage_templates/command_help.erb
|
294
301
|
- lib/rhc/usage_templates/help.erb
|
302
|
+
- lib/rhc/autocomplete_templates/rhc.erb
|
295
303
|
- conf/express.conf
|
296
304
|
- LICENSE
|
297
305
|
- COPYRIGHT
|
298
306
|
- README.md
|
299
307
|
- Rakefile
|
300
|
-
-
|
301
|
-
- test/support/server.rb
|
302
|
-
- test/unit/command_test.rb
|
303
|
-
- test/sample-usage.rb
|
304
|
-
- test/functional/domain_test.rb
|
305
|
-
- test/functional/application_test.rb
|
306
|
-
- test/functional/test_credentials.rb
|
307
|
-
- test/test_helper.rb
|
308
|
+
- spec/spec.opts
|
308
309
|
- spec/rhc/helpers_spec.rb
|
309
310
|
- spec/rhc/config_spec.rb
|
310
311
|
- spec/rhc/rest_client_spec.rb
|
@@ -316,6 +317,8 @@ files:
|
|
316
317
|
- spec/rhc/assets/targz_corrupted.tar.gz
|
317
318
|
- spec/rhc/assets/targz_sample.tar.gz
|
318
319
|
- spec/rhc/command_spec.rb
|
320
|
+
- spec/rhc/commands/port-forward_spec.rb
|
321
|
+
- spec/rhc/commands/sshkey_spec.rb
|
319
322
|
- spec/rhc/commands/setup_spec.rb
|
320
323
|
- spec/rhc/commands/domain_spec.rb
|
321
324
|
- spec/rhc/commands/server_spec.rb
|
@@ -325,21 +328,37 @@ files:
|
|
325
328
|
- spec/rest_spec_helper.rb
|
326
329
|
- spec/spec_helper.rb
|
327
330
|
- spec/coverage_helper.rb
|
331
|
+
- features/sshkey.feature
|
332
|
+
- features/support/key1
|
328
333
|
- features/support/env.rb
|
334
|
+
- features/support/key1.pub
|
335
|
+
- features/support/before_hooks.rb
|
336
|
+
- features/support/assumptions.rb
|
337
|
+
- features/support/ssh.sh
|
338
|
+
- features/support/key2
|
339
|
+
- features/support/key3.pub
|
340
|
+
- features/support/key2.pub
|
341
|
+
- features/step_definitions/sshkey_steps.rb
|
329
342
|
- features/step_definitions/client_steps.rb
|
330
343
|
- features/step_definitions/application_steps.rb
|
331
344
|
- features/step_definitions/cartridge_steps.rb
|
332
345
|
- features/step_definitions/domain_steps.rb
|
346
|
+
- features/multiple_cartridge.feature
|
333
347
|
- features/verify.feature
|
348
|
+
- features/cartridge.feature
|
349
|
+
- features/application.feature
|
334
350
|
- features/lib/rhc_helper.rb
|
335
351
|
- features/lib/rhc_helper/httpify.rb
|
336
352
|
- features/lib/rhc_helper/persistable.rb
|
337
353
|
- features/lib/rhc_helper/loggable.rb
|
338
354
|
- features/lib/rhc_helper/domain.rb
|
355
|
+
- features/lib/rhc_helper/sshkey.rb
|
339
356
|
- features/lib/rhc_helper/commandify.rb
|
340
357
|
- features/lib/rhc_helper/cartridge.rb
|
341
358
|
- features/lib/rhc_helper/app.rb
|
342
359
|
- features/lib/rhc_helper/runnable.rb
|
360
|
+
- features/domain.feature
|
361
|
+
- features/client.feature
|
343
362
|
- features/README.md
|
344
363
|
- bin/rhc-tail-files
|
345
364
|
- bin/rhc-sshkey
|
@@ -390,14 +409,7 @@ signing_key:
|
|
390
409
|
specification_version: 3
|
391
410
|
summary: OpenShift Client Tools
|
392
411
|
test_files:
|
393
|
-
-
|
394
|
-
- test/support/server.rb
|
395
|
-
- test/unit/command_test.rb
|
396
|
-
- test/sample-usage.rb
|
397
|
-
- test/functional/domain_test.rb
|
398
|
-
- test/functional/application_test.rb
|
399
|
-
- test/functional/test_credentials.rb
|
400
|
-
- test/test_helper.rb
|
412
|
+
- spec/spec.opts
|
401
413
|
- spec/rhc/helpers_spec.rb
|
402
414
|
- spec/rhc/config_spec.rb
|
403
415
|
- spec/rhc/rest_client_spec.rb
|
@@ -409,6 +421,8 @@ test_files:
|
|
409
421
|
- spec/rhc/assets/targz_corrupted.tar.gz
|
410
422
|
- spec/rhc/assets/targz_sample.tar.gz
|
411
423
|
- spec/rhc/command_spec.rb
|
424
|
+
- spec/rhc/commands/port-forward_spec.rb
|
425
|
+
- spec/rhc/commands/sshkey_spec.rb
|
412
426
|
- spec/rhc/commands/setup_spec.rb
|
413
427
|
- spec/rhc/commands/domain_spec.rb
|
414
428
|
- spec/rhc/commands/server_spec.rb
|
@@ -418,19 +432,35 @@ test_files:
|
|
418
432
|
- spec/rest_spec_helper.rb
|
419
433
|
- spec/spec_helper.rb
|
420
434
|
- spec/coverage_helper.rb
|
435
|
+
- features/sshkey.feature
|
436
|
+
- features/support/key1
|
421
437
|
- features/support/env.rb
|
438
|
+
- features/support/key1.pub
|
439
|
+
- features/support/before_hooks.rb
|
440
|
+
- features/support/assumptions.rb
|
441
|
+
- features/support/ssh.sh
|
442
|
+
- features/support/key2
|
443
|
+
- features/support/key3.pub
|
444
|
+
- features/support/key2.pub
|
445
|
+
- features/step_definitions/sshkey_steps.rb
|
422
446
|
- features/step_definitions/client_steps.rb
|
423
447
|
- features/step_definitions/application_steps.rb
|
424
448
|
- features/step_definitions/cartridge_steps.rb
|
425
449
|
- features/step_definitions/domain_steps.rb
|
450
|
+
- features/multiple_cartridge.feature
|
426
451
|
- features/verify.feature
|
452
|
+
- features/cartridge.feature
|
453
|
+
- features/application.feature
|
427
454
|
- features/lib/rhc_helper.rb
|
428
455
|
- features/lib/rhc_helper/httpify.rb
|
429
456
|
- features/lib/rhc_helper/persistable.rb
|
430
457
|
- features/lib/rhc_helper/loggable.rb
|
431
458
|
- features/lib/rhc_helper/domain.rb
|
459
|
+
- features/lib/rhc_helper/sshkey.rb
|
432
460
|
- features/lib/rhc_helper/commandify.rb
|
433
461
|
- features/lib/rhc_helper/cartridge.rb
|
434
462
|
- features/lib/rhc_helper/app.rb
|
435
463
|
- features/lib/rhc_helper/runnable.rb
|
464
|
+
- features/domain.feature
|
465
|
+
- features/client.feature
|
436
466
|
- features/README.md
|
@@ -1,75 +0,0 @@
|
|
1
|
-
module Rhc
|
2
|
-
module Rest
|
3
|
-
class BaseException < RuntimeError
|
4
|
-
attr_reader :code
|
5
|
-
def initialize(message=nil, code=nil)
|
6
|
-
super(message)
|
7
|
-
@code = code
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
#Exceptions thrown in case of an HTTP 5xx is received.
|
12
|
-
class ServerErrorException < Rhc::Rest::BaseException; end
|
13
|
-
|
14
|
-
#Exceptions thrown in case of an HTTP 503 is received.
|
15
|
-
#
|
16
|
-
#503 Service Unavailable
|
17
|
-
#
|
18
|
-
#The server is currently unable to handle the request due to a temporary
|
19
|
-
#overloading or maintenance of the server. The implication is that this
|
20
|
-
#is a temporary condition which will be alleviated after some delay.
|
21
|
-
|
22
|
-
class ServiceUnavailableException < Rhc::Rest::ServerErrorException; end
|
23
|
-
|
24
|
-
#Exceptions thrown in case of an HTTP 4xx is received with the exception
|
25
|
-
#of 401, 403, 403 and 422 where a more sepcific exception is thrown
|
26
|
-
#
|
27
|
-
#HTTP Error Codes 4xx
|
28
|
-
#
|
29
|
-
#The 4xx class of status code is intended for cases in which the client
|
30
|
-
#seems to have errored.
|
31
|
-
|
32
|
-
|
33
|
-
class ClientErrorException < Rhc::Rest::BaseException; end
|
34
|
-
|
35
|
-
#Exceptions thrown in case of an HTTP 404 is received.
|
36
|
-
#
|
37
|
-
#404 Not Found
|
38
|
-
#
|
39
|
-
#The server has not found anything matching the Request-URI or the
|
40
|
-
#requested resource does not exist
|
41
|
-
class ResourceNotFoundException < Rhc::Rest::ClientErrorException; end
|
42
|
-
|
43
|
-
#Exceptions thrown in case of an HTTP 422 is received.
|
44
|
-
class ValidationException < Rhc::Rest::ClientErrorException
|
45
|
-
attr_reader :field
|
46
|
-
def initialize(message, field=nil, error_code=nil)
|
47
|
-
super(message, error_code)
|
48
|
-
@field = field
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
#Exceptions thrown in case of an HTTP 403 is received.
|
53
|
-
#
|
54
|
-
#403 Forbidden
|
55
|
-
#
|
56
|
-
#The server understood the request, but is refusing to fulfill it.
|
57
|
-
#Authorization will not help and the request SHOULD NOT be repeated.
|
58
|
-
class RequestDeniedException < Rhc::Rest::ClientErrorException; end
|
59
|
-
|
60
|
-
#Exceptions thrown in case of an HTTP 401 is received.
|
61
|
-
#
|
62
|
-
#401 Unauthorized
|
63
|
-
#
|
64
|
-
#The request requires user authentication. If the request already
|
65
|
-
#included Authorization credentials, then the 401 response indicates
|
66
|
-
#that authorization has been refused for those credentials.
|
67
|
-
class UnAuthorizedException < Rhc::Rest::ClientErrorException; end
|
68
|
-
|
69
|
-
# Unreachable host, SSL Exception
|
70
|
-
class ResourceAccessException < Rhc::Rest::BaseException; end
|
71
|
-
#I/O Exceptions Connection timeouts, etc
|
72
|
-
class ConnectionException < Rhc::Rest::BaseException; end
|
73
|
-
class TimeoutException < ConnectionException; end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', __FILE__)
|
2
|
-
|
3
|
-
class ApplicationTest < Test::Unit::TestCase
|
4
|
-
setup :with_devenv
|
5
|
-
|
6
|
-
def teardown
|
7
|
-
if @client && @client.domains
|
8
|
-
@client.domains.each do |domain|
|
9
|
-
domain.delete(true)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_create_app
|
15
|
-
domain_name = "rhcrest#{@random}"
|
16
|
-
domain = @client.add_domain(domain_name)
|
17
|
-
assert domain.namespace == domain_name
|
18
|
-
app = domain.add_application("app", {:cartridge => "php-5.3"})
|
19
|
-
puts app
|
20
|
-
assert app.name == "app", "application name is not equal "
|
21
|
-
puts app.framework
|
22
|
-
assert app.framework == "php-5.3"
|
23
|
-
apps = @client.find_application("app")
|
24
|
-
assert apps.length == 1
|
25
|
-
assert apps.first.name == "app"
|
26
|
-
end
|
27
|
-
|
28
|
-
=begin
|
29
|
-
def test_create_scalable_app
|
30
|
-
domain_name = "rhcrest#{@random}"
|
31
|
-
domain = @client.add_domain(domain_name)
|
32
|
-
assert domain.namespace == domain_name
|
33
|
-
app = domain.add_application("app", {:cartridge => "php-5.3", :scale => true})
|
34
|
-
assert app.name == "app"
|
35
|
-
assert app.framework == "php-5.3"
|
36
|
-
assert app.scalable == true
|
37
|
-
apps = @client.find_application("app")
|
38
|
-
assert apps.length == 1
|
39
|
-
assert apps.first.name == "app"
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_create_app_with_small_node
|
43
|
-
domain_name = "rhcrest#{@random}"
|
44
|
-
domain = @client.add_domain(domain_name)
|
45
|
-
assert domain.namespace == domain_name
|
46
|
-
app = domain.add_application("app", {:cartridge => "php-5.3", :node_profile => "small"})
|
47
|
-
assert app.name == "app"
|
48
|
-
assert app.framework == "php-5.3"
|
49
|
-
assert app.node_profile = "small"
|
50
|
-
apps = @client.find_application("app")
|
51
|
-
assert apps.length == 1
|
52
|
-
assert apps.first.name == "app"
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_create_scalable_app_with_small_node
|
57
|
-
domain_name = "rhcrest#{@random}"
|
58
|
-
domain = @client.add_domain(domain_name)
|
59
|
-
assert domain.namespace == domain_name
|
60
|
-
app = domain.add_application("app", {:cartridge => "php-5.3", :scale => true, :node_profile => "small"})
|
61
|
-
assert app.name == "app"
|
62
|
-
assert app.framework == "php-5.3"
|
63
|
-
assert app.node_profile = "small"
|
64
|
-
assert app.scalable == true
|
65
|
-
apps = @client.find_application("app")
|
66
|
-
assert apps.length == 1
|
67
|
-
assert apps.first.name == "app"
|
68
|
-
end
|
69
|
-
=end
|
70
|
-
|
71
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', __FILE__)
|
2
|
-
|
3
|
-
class DomainTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
setup :with_devenv
|
6
|
-
|
7
|
-
def teardown
|
8
|
-
if @client && @client.domains
|
9
|
-
@client.domains.each do |domain|
|
10
|
-
domain.delete(true)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_create_domain
|
16
|
-
|
17
|
-
domain_name = "rhcrest#{@random}"
|
18
|
-
|
19
|
-
domain = @client.add_domain(domain_name)
|
20
|
-
assert domain.namespace == domain_name
|
21
|
-
|
22
|
-
domains = @client.domains
|
23
|
-
assert domains.length == 1
|
24
|
-
domain = domains.first
|
25
|
-
assert domain.namespace == domain_name
|
26
|
-
|
27
|
-
domains = @client.find_domain(domain_name)
|
28
|
-
assert domains.length == 1
|
29
|
-
domain = domains.first
|
30
|
-
assert domain.namespace == domain_name
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_create_multiple_domains
|
35
|
-
|
36
|
-
domain_name = "rhcrest#{@random}"
|
37
|
-
domain = @client.add_domain(domain_name)
|
38
|
-
assert domain.namespace == domain_name
|
39
|
-
|
40
|
-
domains = @client.domains
|
41
|
-
assert domains.length == 1
|
42
|
-
domain = domains.first
|
43
|
-
assert domain.namespace == domain_name
|
44
|
-
|
45
|
-
domains = @client.find_domain(domain_name)
|
46
|
-
assert domains.length == 1
|
47
|
-
domain = domains.first
|
48
|
-
assert domain.namespace == domain_name
|
49
|
-
|
50
|
-
domain_name = "rhcrest#{@random}X"
|
51
|
-
domain = @client.add_domain(domain_name)
|
52
|
-
assert domain.namespace == domain_name
|
53
|
-
|
54
|
-
domains = @client.domains
|
55
|
-
assert domains.length == 2
|
56
|
-
|
57
|
-
domains = @client.find_domain(domain_name)
|
58
|
-
assert domains.length == 1
|
59
|
-
domain = domains.first
|
60
|
-
assert domain.namespace == domain_name
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_update_domain
|
64
|
-
|
65
|
-
domain_name = "rhcrest#{@random}"
|
66
|
-
domain = @client.add_domain(domain_name)
|
67
|
-
assert domain.namespace == domain_name
|
68
|
-
new_domain_name = "rhcrest#{@random}X"
|
69
|
-
domain = domain.update(new_domain_name)
|
70
|
-
|
71
|
-
domains = @client.domains
|
72
|
-
assert domains.length == 1
|
73
|
-
domain = domains.first
|
74
|
-
assert domain.namespace == new_domain_name
|
75
|
-
|
76
|
-
domains = @client.find_domain(new_domain_name)
|
77
|
-
assert domains.length == 1
|
78
|
-
domain = domains.first
|
79
|
-
assert domain.namespace == new_domain_name
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_update_domain_with_app
|
84
|
-
|
85
|
-
domain_name = "rhcrest#{@random}"
|
86
|
-
domain = @client.add_domain(domain_name)
|
87
|
-
assert domain.namespace == domain_name
|
88
|
-
app = domain.add_application("app", {:cartridge => "php-5.3"})
|
89
|
-
new_domain_name = "rhcrest#{@random}X"
|
90
|
-
domain = domain.update(new_domain_name)
|
91
|
-
|
92
|
-
domains = @client.domains
|
93
|
-
assert domains.length == 1
|
94
|
-
domain = domains.first
|
95
|
-
assert domain.namespace == new_domain_name
|
96
|
-
|
97
|
-
domains = @client.find_domain(new_domain_name)
|
98
|
-
assert domains.length == 1
|
99
|
-
domain = domains.first
|
100
|
-
assert domain.namespace == new_domain_name
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_delete_domain_with_app
|
105
|
-
|
106
|
-
domain_name = "rhcrest#{@random}"
|
107
|
-
domain = @client.add_domain(domain_name)
|
108
|
-
assert domain.namespace == domain_name
|
109
|
-
app = domain.add_application("app", {:cartridge => "php-5.3"})
|
110
|
-
assert_raise Rhc::Rest::ClientErrorException do
|
111
|
-
domain.delete
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_force_delete_domain_with_app
|
116
|
-
domain_name = "rhcrest#{@random}"
|
117
|
-
domain = @client.add_domain(domain_name)
|
118
|
-
assert domain.namespace == domain_name
|
119
|
-
app = domain.add_application("app", {:cartridge => "php-5.3"})
|
120
|
-
domain.delete(true)
|
121
|
-
assert @client.domains.length == 0
|
122
|
-
end
|
123
|
-
end
|