engineyard 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/engineyard/version.rb +2 -2
- data/spec/engineyard/cli/api_spec.rb +6 -6
- data/spec/engineyard/cli_spec.rb +5 -5
- data/spec/engineyard/config_spec.rb +7 -7
- data/spec/engineyard/deploy_config_spec.rb +39 -39
- data/spec/engineyard/eyrc_spec.rb +13 -13
- data/spec/engineyard/repo_spec.rb +8 -8
- data/spec/engineyard_spec.rb +1 -1
- data/spec/ey/deploy_spec.rb +64 -64
- data/spec/ey/ey_spec.rb +3 -3
- data/spec/ey/list_environments_spec.rb +28 -28
- data/spec/ey/login_spec.rb +5 -5
- data/spec/ey/logout_spec.rb +5 -5
- data/spec/ey/logs_spec.rb +5 -5
- data/spec/ey/rebuild_spec.rb +1 -1
- data/spec/ey/recipes/apply_spec.rb +2 -2
- data/spec/ey/recipes/download_spec.rb +3 -3
- data/spec/ey/recipes/upload_spec.rb +8 -8
- data/spec/ey/rollback_spec.rb +13 -13
- data/spec/ey/scp_spec.rb +6 -6
- data/spec/ey/servers_spec.rb +49 -49
- data/spec/ey/ssh_spec.rb +14 -14
- data/spec/ey/status_spec.rb +21 -21
- data/spec/ey/timeout_deploy_spec.rb +3 -3
- data/spec/ey/web/disable_spec.rb +1 -1
- data/spec/ey/web/enable_spec.rb +2 -2
- data/spec/ey/web/restart_spec.rb +1 -1
- data/spec/ey/whoami_spec.rb +5 -5
- data/spec/support/shared_behavior.rb +30 -30
- metadata +9 -9
data/spec/ey/login_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe "ey login" do
|
|
10
10
|
|
11
11
|
it "returns the logged in user name" do
|
12
12
|
ey %w[login]
|
13
|
-
@out.
|
13
|
+
expect(@out).to include("User Name (#{scenario_email})")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -23,11 +23,11 @@ describe "ey login" do
|
|
23
23
|
input.puts(scenario_password)
|
24
24
|
end
|
25
25
|
|
26
|
-
@out.
|
27
|
-
@out.
|
28
|
-
@out.
|
26
|
+
expect(@out).to include("We need to fetch your API token; please log in.")
|
27
|
+
expect(@out).to include("Email:")
|
28
|
+
expect(@out).to include("Password:")
|
29
29
|
|
30
|
-
@out.
|
30
|
+
expect(@out).to include("User Name (#{scenario_email})")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/spec/ey/logout_spec.rb
CHANGED
@@ -8,17 +8,17 @@ describe "ey logout" do
|
|
8
8
|
|
9
9
|
it "logs you out" do
|
10
10
|
ey %w[logout]
|
11
|
-
@out.
|
12
|
-
@out.
|
11
|
+
expect(@out).to include("API token removed: #{ENV['EYRC']}")
|
12
|
+
expect(@out).to include("Run any other command to login again.")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
context "not logged in" do
|
17
17
|
it "doesn't prompt for login before logging out" do
|
18
18
|
ey %w[logout]
|
19
|
-
@out.
|
20
|
-
@out.
|
21
|
-
@out.
|
19
|
+
expect(@out).not_to include("API token removed:")
|
20
|
+
expect(@out).to include("Already logged out.")
|
21
|
+
expect(@out).to include("Run any other command to login again.")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/spec/ey/logs_spec.rb
CHANGED
@@ -6,15 +6,15 @@ describe "ey logs" do
|
|
6
6
|
it "prints logs returned by awsm" do
|
7
7
|
login_scenario "one app, one environment"
|
8
8
|
fast_ey %w[logs -e giblets]
|
9
|
-
@out.
|
10
|
-
@out.
|
11
|
-
@err.
|
9
|
+
expect(@out).to match(/MAIN LOG OUTPUT/)
|
10
|
+
expect(@out).to match(/CUSTOM LOG OUTPUT/)
|
11
|
+
expect(@err).to eq('')
|
12
12
|
end
|
13
13
|
|
14
14
|
it "complains when it can't infer the environment" do
|
15
15
|
login_scenario "one app, many environments"
|
16
16
|
fast_failing_ey %w[logs]
|
17
|
-
@err.
|
17
|
+
expect(@err).to match(/Multiple environments possible, please be more specific/i)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -29,7 +29,7 @@ describe "ey logs" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def verify_ran(scenario)
|
32
|
-
@out.
|
32
|
+
expect(@out).to match(/Main logs for #{scenario[:environment]}/)
|
33
33
|
end
|
34
34
|
|
35
35
|
include_examples "it takes an environment name and an account name"
|
data/spec/ey/rebuild_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe "ey rebuild" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def verify_ran(scenario)
|
14
|
-
@out.
|
14
|
+
expect(@out).to match(/Updating instances on #{scenario[:account]} \/ #{scenario[:environment]}/)
|
15
15
|
end
|
16
16
|
|
17
17
|
include_examples "it takes an environment name and an account name"
|
@@ -11,14 +11,14 @@ describe "ey recipes apply" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def verify_ran(scenario)
|
14
|
-
@out.
|
14
|
+
expect(@out).to match(/Uploaded recipes started for #{scenario[:environment]}/)
|
15
15
|
end
|
16
16
|
|
17
17
|
include_examples "it takes an environment name and an account name"
|
18
18
|
|
19
19
|
it "fails when given a bad option" do
|
20
20
|
fast_failing_ey %w[web enable --lots --of --bogus --options]
|
21
|
-
@err.
|
21
|
+
expect(@err).to include("Unknown switches")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -22,8 +22,8 @@ describe "ey recipes download" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def verify_ran(scenario)
|
25
|
-
@out.
|
26
|
-
File.read('cookbooks/README').
|
25
|
+
expect(@out).to match(/Recipes downloaded successfully for #{scenario[:environment]}/)
|
26
|
+
expect(File.read('cookbooks/README')).to eq("Remove this file to clone an upstream git repository of cookbooks\n")
|
27
27
|
end
|
28
28
|
|
29
29
|
include_examples "it takes an environment name and an account name"
|
@@ -32,7 +32,7 @@ describe "ey recipes download" do
|
|
32
32
|
login_scenario "one app, one environment"
|
33
33
|
Dir.mkdir("cookbooks")
|
34
34
|
ey %w[recipes download], :expect_failure => true
|
35
|
-
@err.
|
35
|
+
expect(@err).to match(/cookbooks.*already exists/i)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -13,7 +13,7 @@ describe "ey recipes upload" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def verify_ran(scenario)
|
16
|
-
@out.
|
16
|
+
expect(@out).to match(%r|Recipes in cookbooks/ uploaded successfully for #{scenario[:environment]}|)
|
17
17
|
end
|
18
18
|
|
19
19
|
include_examples "it takes an environment name and an account name"
|
@@ -33,7 +33,7 @@ describe "ey recipes upload -f recipes.tgz" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def verify_ran(scenario)
|
36
|
-
@out.
|
36
|
+
expect(@out).to match(%r|Recipes file recipes.tgz uploaded successfully for #{scenario[:environment]}|)
|
37
37
|
end
|
38
38
|
|
39
39
|
include_examples "it takes an environment name and an account name"
|
@@ -52,7 +52,7 @@ describe "ey recipes upload -f with a missing filenamen" do
|
|
52
52
|
it "errors with file not found" do
|
53
53
|
login_scenario "one app, one environment"
|
54
54
|
fast_failing_ey(%w[recipes upload --environment giblets -f recipes.tgz])
|
55
|
-
@err.
|
55
|
+
expect(@err).to match(/Recipes file not found: recipes.tgz/i)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -72,16 +72,16 @@ describe "ey recipes upload from a separate cookbooks directory" do
|
|
72
72
|
login_scenario "one app, one environment"
|
73
73
|
|
74
74
|
ey %w[recipes upload -e giblets]
|
75
|
-
@out.
|
76
|
-
@out.
|
75
|
+
expect(@out).to match(%r|Recipes in cookbooks/ uploaded successfully|)
|
76
|
+
expect(@out).not_to match(/Uploaded recipes started for giblets/)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "applies the recipes with --apply" do
|
80
80
|
login_scenario "one app, one environment"
|
81
81
|
|
82
82
|
ey %w[recipes upload -e giblets --apply]
|
83
|
-
@out.
|
84
|
-
@out.
|
83
|
+
expect(@out).to match(%r|Recipes in cookbooks/ uploaded successfully|)
|
84
|
+
expect(@out).to match(/Uploaded recipes started for giblets/)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -92,7 +92,7 @@ describe "ey recipes upload from a separate cookbooks directory" do
|
|
92
92
|
login_scenario "one app, one environment"
|
93
93
|
|
94
94
|
ey %w[recipes upload -e giblets]
|
95
|
-
@out.
|
95
|
+
expect(@out).to match(%r|Recipes in cookbooks/ uploaded successfully|)
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|
data/spec/ey/rollback_spec.rb
CHANGED
@@ -13,9 +13,9 @@ describe "ey rollback" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def verify_ran(scenario)
|
16
|
-
@out.
|
17
|
-
@err.
|
18
|
-
@ssh_commands.last.
|
16
|
+
expect(@out).to match(/Rolling back.*#{scenario[:application]}.*#{scenario[:environment]}/)
|
17
|
+
expect(@err).to eq('')
|
18
|
+
expect(@ssh_commands.last).to match(/engineyard-serverside.*deploy rollback.*--app #{scenario[:application]}/)
|
19
19
|
end
|
20
20
|
|
21
21
|
include_examples "it takes an environment name and an app name and an account name"
|
@@ -24,7 +24,7 @@ describe "ey rollback" do
|
|
24
24
|
it "passes along the web server stack to engineyard-serverside" do
|
25
25
|
login_scenario "one app, one environment"
|
26
26
|
ey %w[rollback]
|
27
|
-
@ssh_commands.last.
|
27
|
+
expect(@ssh_commands.last).to match(/--stack nginx_mongrel/)
|
28
28
|
end
|
29
29
|
|
30
30
|
context "--config (--extra-deploy-hook-options)" do
|
@@ -42,18 +42,18 @@ describe "ey rollback" do
|
|
42
42
|
|
43
43
|
it "passes --config to engineyard-serverside" do
|
44
44
|
ey %w[rollback --config some:stuff more:crap]
|
45
|
-
config_options.
|
46
|
-
config_options['some'].
|
47
|
-
config_options['more'].
|
48
|
-
config_options['input_ref'].
|
49
|
-
config_options['deployed_by'].
|
45
|
+
expect(config_options).not_to be_nil
|
46
|
+
expect(config_options['some']).to eq('stuff')
|
47
|
+
expect(config_options['more']).to eq('crap')
|
48
|
+
expect(config_options['input_ref']).not_to be_nil
|
49
|
+
expect(config_options['deployed_by']).not_to be_nil
|
50
50
|
end
|
51
51
|
|
52
52
|
it "supports legacy --extra-deploy-hook-options" do
|
53
53
|
ey %w[rollback --extra-deploy-hook-options some:stuff more:crap]
|
54
|
-
config_options.
|
55
|
-
config_options['some'].
|
56
|
-
config_options['more'].
|
54
|
+
expect(config_options).not_to be_nil
|
55
|
+
expect(config_options['some']).to eq('stuff')
|
56
|
+
expect(config_options['more']).to eq('crap')
|
57
57
|
end
|
58
58
|
|
59
59
|
context "when ey.yml is present" do
|
@@ -65,7 +65,7 @@ describe "ey rollback" do
|
|
65
65
|
|
66
66
|
it "overrides what's in ey.yml" do
|
67
67
|
ey %w[rollback --config beer:esb]
|
68
|
-
config_options['beer'].
|
68
|
+
expect(config_options['beer']).to eq('esb')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
data/spec/ey/scp_spec.rb
CHANGED
@@ -26,16 +26,16 @@ shared_examples_for "running ey scp for select role" do
|
|
26
26
|
login_scenario "one app, one environment"
|
27
27
|
ey command_to_run(from: "from", to: "to", environment: 'giblets', verbose: true)
|
28
28
|
@hosts.each do |host_prefix|
|
29
|
-
@raw_ssh_commands.grep(/^scp from turkey@#{host_prefix}.+:to$/).
|
29
|
+
expect(@raw_ssh_commands.grep(/^scp from turkey@#{host_prefix}.+:to$/)).not_to be_empty
|
30
30
|
end
|
31
|
-
@raw_ssh_commands.grep(/^scp from turkey@.+:to$/).count.
|
31
|
+
expect(@raw_ssh_commands.grep(/^scp from turkey@.+:to$/).count).to eq(@hosts.count)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "is quiet" do
|
35
35
|
login_scenario "one app, one environment"
|
36
36
|
ey command_to_run(from: "from", to: "to", environment: 'giblets', quiet: true)
|
37
|
-
@out.
|
38
|
-
@out.
|
37
|
+
expect(@out).to match(/scp.*from.*to/)
|
38
|
+
expect(@out).not_to match(/Loading application data/)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "raises an error when there are no matching hosts" do
|
@@ -59,7 +59,7 @@ describe "ey scp" do
|
|
59
59
|
|
60
60
|
it "complains if it has no app master" do
|
61
61
|
ey %w[scp from to -e bakon], :expect_failure => true
|
62
|
-
@err.
|
62
|
+
expect(@err).to match(/'bakon' does not have any matching instances/)
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -82,7 +82,7 @@ describe "ey scp" do
|
|
82
82
|
|
83
83
|
def verify_ran(scenario)
|
84
84
|
scp_target = scenario[:ssh_username] + '@' + scenario[:master_hostname]
|
85
|
-
@raw_ssh_commands.
|
85
|
+
expect(@raw_ssh_commands).to eq(["scp #{scp_target}:from to"])
|
86
86
|
end
|
87
87
|
|
88
88
|
include_examples "it takes an environment name and an account name"
|
data/spec/ey/servers_spec.rb
CHANGED
@@ -12,8 +12,8 @@ describe "ey servers" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def verify_ran(scenario)
|
15
|
-
@out.
|
16
|
-
@out.
|
15
|
+
expect(@out).to match(/#{scenario[:environment]}/) if scenario[:environment]
|
16
|
+
expect(@out).to match(/#{scenario[:account]}/) if scenario[:account]
|
17
17
|
end
|
18
18
|
|
19
19
|
include_examples "it takes an environment name and an account name"
|
@@ -25,7 +25,7 @@ describe "ey servers" do
|
|
25
25
|
|
26
26
|
it "prints error when no application found" do
|
27
27
|
fast_failing_ey %w[servers]
|
28
|
-
@err.
|
28
|
+
expect(@err).to match(/No application found/)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -36,8 +36,8 @@ describe "ey servers" do
|
|
36
36
|
|
37
37
|
it "lists the servers with specified env" do
|
38
38
|
fast_ey %w[servers -e giblets]
|
39
|
-
@out.
|
40
|
-
@out.
|
39
|
+
expect(@out).to match(/main \/ giblets/)
|
40
|
+
expect(@out).to include('1 server ')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -48,31 +48,31 @@ describe "ey servers" do
|
|
48
48
|
|
49
49
|
it "lists the servers with specified env" do
|
50
50
|
fast_ey %w[servers -c main -e giblets]
|
51
|
-
@out.
|
52
|
-
@out.
|
53
|
-
@out.
|
54
|
-
@out.
|
55
|
-
@out.
|
56
|
-
@out.
|
57
|
-
@out.
|
58
|
-
@out.
|
51
|
+
expect(@out).to include("# 7 servers on main / giblets")
|
52
|
+
expect(@out).to include("app_master_hostname.compute-1.amazonaws.com \ti-ddbbdd92\tapp_master")
|
53
|
+
expect(@out).to include("app_hostname.compute-1.amazonaws.com \ti-d2e3f1b9\tapp")
|
54
|
+
expect(@out).to include("db_master_hostname.compute-1.amazonaws.com \ti-d4cdddbf\tdb_master")
|
55
|
+
expect(@out).to include("db_slave_1_hostname.compute-1.amazonaws.com \ti-asdfasdfaj\tdb_slave \tSlave I")
|
56
|
+
expect(@out).to include("db_slave_2_hostname.compute-1.amazonaws.com \ti-asdfasdfaj\tdb_slave")
|
57
|
+
expect(@out).to include("util_fluffy_hostname.compute-1.amazonaws.com\ti-80e3f1eb\tutil \tfluffy")
|
58
|
+
expect(@out).to include("util_rocky_hostname.compute-1.amazonaws.com \ti-80etf1eb\tutil \trocky")
|
59
59
|
end
|
60
60
|
|
61
61
|
it "lists the servers with specified env with users" do
|
62
62
|
fast_ey %w[servers -c main -e giblets -u]
|
63
|
-
@out.
|
64
|
-
@out.
|
65
|
-
@out.
|
66
|
-
@out.
|
67
|
-
@out.
|
68
|
-
@out.
|
69
|
-
@out.
|
70
|
-
@out.
|
63
|
+
expect(@out).to include("# 7 servers on main / giblets")
|
64
|
+
expect(@out).to include("turkey@app_master_hostname.compute-1.amazonaws.com \ti-ddbbdd92\tapp_master")
|
65
|
+
expect(@out).to include("turkey@app_hostname.compute-1.amazonaws.com \ti-d2e3f1b9\tapp")
|
66
|
+
expect(@out).to include("turkey@db_master_hostname.compute-1.amazonaws.com \ti-d4cdddbf\tdb_master")
|
67
|
+
expect(@out).to include("turkey@db_slave_1_hostname.compute-1.amazonaws.com \ti-asdfasdfaj\tdb_slave \tSlave I")
|
68
|
+
expect(@out).to include("turkey@db_slave_2_hostname.compute-1.amazonaws.com \ti-asdfasdfaj\tdb_slave")
|
69
|
+
expect(@out).to include("turkey@util_fluffy_hostname.compute-1.amazonaws.com\ti-80e3f1eb\tutil \tfluffy")
|
70
|
+
expect(@out).to include("turkey@util_rocky_hostname.compute-1.amazonaws.com \ti-80etf1eb\tutil \trocky")
|
71
71
|
end
|
72
72
|
|
73
73
|
it "lists simple format servers" do
|
74
74
|
fast_ey %w[servers -c main -e giblets -qs], :debug => false
|
75
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
75
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
76
76
|
['app_master_hostname.compute-1.amazonaws.com', 'i-ddbbdd92', 'app_master' ],
|
77
77
|
['app_hostname.compute-1.amazonaws.com', 'i-d2e3f1b9', 'app' ],
|
78
78
|
['db_master_hostname.compute-1.amazonaws.com', 'i-d4cdddbf', 'db_master' ],
|
@@ -80,12 +80,12 @@ describe "ey servers" do
|
|
80
80
|
['db_slave_2_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave' ],
|
81
81
|
['util_fluffy_hostname.compute-1.amazonaws.com', 'i-80e3f1eb', 'util', 'fluffy' ],
|
82
82
|
['util_rocky_hostname.compute-1.amazonaws.com', 'i-80etf1eb', 'util', 'rocky' ],
|
83
|
-
]
|
83
|
+
])
|
84
84
|
end
|
85
85
|
|
86
86
|
it "lists simple format servers with users" do
|
87
87
|
fast_ey %w[servers -c main -e giblets -qsu], :debug => false
|
88
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
88
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
89
89
|
['turkey@app_master_hostname.compute-1.amazonaws.com', 'i-ddbbdd92', 'app_master' ],
|
90
90
|
['turkey@app_hostname.compute-1.amazonaws.com', 'i-d2e3f1b9', 'app' ],
|
91
91
|
['turkey@db_master_hostname.compute-1.amazonaws.com', 'i-d4cdddbf', 'db_master' ],
|
@@ -93,12 +93,12 @@ describe "ey servers" do
|
|
93
93
|
['turkey@db_slave_2_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave' ],
|
94
94
|
['turkey@util_fluffy_hostname.compute-1.amazonaws.com', 'i-80e3f1eb', 'util', 'fluffy' ],
|
95
95
|
['turkey@util_rocky_hostname.compute-1.amazonaws.com', 'i-80etf1eb', 'util', 'rocky' ],
|
96
|
-
]
|
96
|
+
])
|
97
97
|
end
|
98
98
|
|
99
99
|
it "lists host only" do
|
100
100
|
fast_ey %w[servers -c main -e giblets -qS], :debug => false
|
101
|
-
@out.split(/\n/).
|
101
|
+
expect(@out.split(/\n/)).to eq([
|
102
102
|
'app_master_hostname.compute-1.amazonaws.com',
|
103
103
|
'app_hostname.compute-1.amazonaws.com',
|
104
104
|
'db_master_hostname.compute-1.amazonaws.com',
|
@@ -106,12 +106,12 @@ describe "ey servers" do
|
|
106
106
|
'db_slave_2_hostname.compute-1.amazonaws.com',
|
107
107
|
'util_fluffy_hostname.compute-1.amazonaws.com',
|
108
108
|
'util_rocky_hostname.compute-1.amazonaws.com',
|
109
|
-
]
|
109
|
+
])
|
110
110
|
end
|
111
111
|
|
112
112
|
it "lists host only with users" do
|
113
113
|
fast_ey %w[servers -c main -e giblets -qSu], :debug => false
|
114
|
-
@out.split(/\n/).
|
114
|
+
expect(@out.split(/\n/)).to eq([
|
115
115
|
'turkey@app_master_hostname.compute-1.amazonaws.com',
|
116
116
|
'turkey@app_hostname.compute-1.amazonaws.com',
|
117
117
|
'turkey@db_master_hostname.compute-1.amazonaws.com',
|
@@ -119,90 +119,90 @@ describe "ey servers" do
|
|
119
119
|
'turkey@db_slave_2_hostname.compute-1.amazonaws.com',
|
120
120
|
'turkey@util_fluffy_hostname.compute-1.amazonaws.com',
|
121
121
|
'turkey@util_rocky_hostname.compute-1.amazonaws.com',
|
122
|
-
]
|
122
|
+
])
|
123
123
|
end
|
124
124
|
|
125
125
|
it "lists servers constrained to app servers" do
|
126
126
|
fast_ey %w[servers -c main -e giblets -qs --app-servers], :debug => false
|
127
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
127
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
128
128
|
['app_master_hostname.compute-1.amazonaws.com', 'i-ddbbdd92', 'app_master' ],
|
129
129
|
['app_hostname.compute-1.amazonaws.com', 'i-d2e3f1b9', 'app' ],
|
130
|
-
]
|
130
|
+
])
|
131
131
|
end
|
132
132
|
|
133
133
|
it "lists servers constrained to db servers" do
|
134
134
|
fast_ey %w[servers -c main -e giblets -qs --db-servers], :debug => false
|
135
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
135
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
136
136
|
['db_master_hostname.compute-1.amazonaws.com', 'i-d4cdddbf', 'db_master' ],
|
137
137
|
['db_slave_1_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave', 'Slave I'],
|
138
138
|
['db_slave_2_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave' ],
|
139
|
-
]
|
139
|
+
])
|
140
140
|
end
|
141
141
|
|
142
142
|
it "lists servers constrained to db master" do
|
143
143
|
fast_ey %w[servers -c main -e giblets -qs --db-master], :debug => false
|
144
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
144
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
145
145
|
['db_master_hostname.compute-1.amazonaws.com', 'i-d4cdddbf', 'db_master' ],
|
146
|
-
]
|
146
|
+
])
|
147
147
|
end
|
148
148
|
|
149
149
|
it "lists servers constrained to db slaves" do
|
150
150
|
fast_ey %w[servers -c main -e giblets -qs --db-slaves], :debug => false
|
151
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
151
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
152
152
|
['db_slave_1_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave', 'Slave I'],
|
153
153
|
['db_slave_2_hostname.compute-1.amazonaws.com', 'i-asdfasdfaj', 'db_slave' ],
|
154
|
-
]
|
154
|
+
])
|
155
155
|
end
|
156
156
|
|
157
157
|
it "lists servers constrained to utilities" do
|
158
158
|
fast_ey %w[servers -c main -e giblets -qs --utilities], :debug => false
|
159
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
159
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
160
160
|
['util_fluffy_hostname.compute-1.amazonaws.com', 'i-80e3f1eb', 'util', 'fluffy' ],
|
161
161
|
['util_rocky_hostname.compute-1.amazonaws.com', 'i-80etf1eb', 'util', 'rocky' ],
|
162
|
-
]
|
162
|
+
])
|
163
163
|
end
|
164
164
|
|
165
165
|
it "lists servers constrained to utilities with names" do
|
166
166
|
fast_ey %w[servers -c main -e giblets -qs --utilities fluffy], :debug => false
|
167
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
167
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
168
168
|
['util_fluffy_hostname.compute-1.amazonaws.com', 'i-80e3f1eb', 'util', 'fluffy' ],
|
169
|
-
]
|
169
|
+
])
|
170
170
|
end
|
171
171
|
|
172
172
|
it "lists servers constrained to app servers and utilities" do
|
173
173
|
fast_ey %w[servers -c main -e giblets -qs --app --util], :debug => false
|
174
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
174
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
175
175
|
['app_master_hostname.compute-1.amazonaws.com', 'i-ddbbdd92', 'app_master' ],
|
176
176
|
['app_hostname.compute-1.amazonaws.com', 'i-d2e3f1b9', 'app' ],
|
177
177
|
['util_fluffy_hostname.compute-1.amazonaws.com', 'i-80e3f1eb', 'util', 'fluffy' ],
|
178
178
|
['util_rocky_hostname.compute-1.amazonaws.com', 'i-80etf1eb', 'util', 'rocky' ],
|
179
|
-
]
|
179
|
+
])
|
180
180
|
end
|
181
181
|
|
182
182
|
it "lists servers constrained to app or util with name" do
|
183
183
|
fast_ey %w[servers -c main -e giblets -qs --app --util rocky], :debug => false
|
184
|
-
@out.split(/\n/).map {|x| x.split(/\t/) }.
|
184
|
+
expect(@out.split(/\n/).map {|x| x.split(/\t/) }).to eq([
|
185
185
|
['app_master_hostname.compute-1.amazonaws.com', 'i-ddbbdd92', 'app_master' ],
|
186
186
|
['app_hostname.compute-1.amazonaws.com', 'i-d2e3f1b9', 'app' ],
|
187
187
|
['util_rocky_hostname.compute-1.amazonaws.com', 'i-80etf1eb', 'util', 'rocky' ],
|
188
|
-
]
|
188
|
+
])
|
189
189
|
end
|
190
190
|
|
191
191
|
it "finds no servers with gibberish " do
|
192
192
|
fast_failing_ey %w[servers --account main --environment gibberish]
|
193
|
-
@err.
|
193
|
+
expect(@err).to include('No environment found matching "gibberish"')
|
194
194
|
end
|
195
195
|
|
196
196
|
it "finds no servers with gibberish account" do
|
197
197
|
fast_failing_ey %w[servers --account gibberish --environment giblets]
|
198
|
-
@err.
|
198
|
+
expect(@err).to include('No account found matching "gibberish"')
|
199
199
|
end
|
200
200
|
|
201
201
|
it "reports failure to find a git repo when not in one" do
|
202
202
|
Dir.chdir(Dir.tmpdir) do
|
203
203
|
fast_failing_ey %w[servers]
|
204
|
-
@err.
|
205
|
-
@out.
|
204
|
+
expect(@err).to match(/fatal: Not a git repository \(or any of the parent directories\): .*#{Regexp.escape(Dir.tmpdir)}/)
|
205
|
+
expect(@out).not_to match(/no application configured/)
|
206
206
|
end
|
207
207
|
end
|
208
208
|
end
|