engineyard 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/ey/ey_spec.rb CHANGED
@@ -3,14 +3,14 @@ require 'spec_helper'
3
3
  describe "ey" do
4
4
  context "run without arguments" do
5
5
  it "prints usage information" do
6
- ey.should include("Tasks:")
6
+ ey.should include("Commands:")
7
7
  end
8
8
  end
9
9
 
10
10
  context "run with an argument that is not a command" do
11
11
  it "tells the user that is not a command" do
12
12
  ey "foobarbaz", :expect_failure => true
13
- @err.should include("Could not find task")
13
+ @err.should include("Could not find command")
14
14
  end
15
15
  end
16
16
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "ey environments" do
4
4
 
5
- it_should_behave_like "an integration test"
5
+ given "integration"
6
6
 
7
7
  before(:all) do
8
8
  api_scenario "one app, two environments"
data/spec/ey/logs_spec.rb CHANGED
@@ -1,19 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "ey logs" do
4
- it_should_behave_like "an integration test"
4
+ given "integration"
5
5
 
6
6
  it "prints logs returned by awsm" do
7
7
  api_scenario "one app, one environment"
8
- ey "logs giblets"
9
- @out.should match(/MAIN LOG OUTPUT/)
10
- @out.should match(/CUSTOM LOG OUTPUT/)
11
- @err.should be_empty
12
- end
13
-
14
- it "can infer the environment" do
15
- api_scenario "one app, one environment"
16
- ey "logs"
8
+ ey "logs -e giblets"
17
9
  @out.should match(/MAIN LOG OUTPUT/)
18
10
  @out.should match(/CUSTOM LOG OUTPUT/)
19
11
  @err.should be_empty
@@ -26,20 +18,18 @@ describe "ey logs" do
26
18
  end
27
19
  end
28
20
 
29
- describe "ey logs ENV" do
30
- it_should_behave_like "an integration test"
21
+ describe "ey logs" do
22
+ given "integration"
31
23
 
32
- before(:all) do
33
- api_scenario "one app, many similarly-named environments"
24
+ def command_to_run(opts)
25
+ cmd = "logs"
26
+ cmd << " --environment #{opts[:env]}" if opts[:env]
27
+ cmd
34
28
  end
35
29
 
36
- it "works when given an unambiguous substring" do
37
- ey "logs prod"
38
- @out.should match(/MAIN LOG OUTPUT/)
30
+ def verify_ran(scenario)
31
+ @out.should match(/Main logs for #{scenario[:environment]}/)
39
32
  end
40
33
 
41
- it "complains when given an ambiguous substring" do
42
- ey "logs staging", :hide_err => true, :expect_failure => true
43
- @err.should match(/'staging' is ambiguous/)
44
- end
34
+ it_should_behave_like "it takes an environment name"
45
35
  end
@@ -1,42 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "ey rebuild" do
4
- it_should_behave_like "an integration test"
4
+ given "integration"
5
5
 
6
- before(:all) do
7
- api_scenario "one app, one environment"
6
+ def command_to_run(opts)
7
+ cmd = "rebuild"
8
+ cmd << " --environment #{opts[:env]}" if opts[:env]
9
+ cmd
8
10
  end
9
11
 
10
- it "works when the environment name is valid" do
11
- ey "rebuild giblets", :debug => true
12
- @out.should =~ /Rebuilding giblets/i
12
+ def verify_ran(scenario)
13
+ @out.should =~ /Rebuilding #{scenario[:environment]}/
13
14
  end
14
15
 
15
- it "rebuilds the current environment by default" do
16
- ey "rebuild", :debug => true
17
- @out.should =~ /Rebuilding giblets/i
18
- end
19
-
20
- it "fails when the environment name is bogus" do
21
- ey "rebuild typo", :expect_failure => true
22
- @err.should match(/'typo'/)
23
- end
24
- end
25
-
26
- describe "ey rebuild ENV" do
27
- it_should_behave_like "an integration test"
28
-
29
- before(:all) do
30
- api_scenario "one app, many similarly-named environments"
31
- end
32
-
33
- it "works when given an unambiguous substring" do
34
- ey "rebuild prod", :debug => true
35
- @out.should =~ /Rebuilding railsapp_production/
36
- end
37
-
38
- it "complains when given an ambiguous substring" do
39
- ey "rebuild staging", :hide_err => true, :expect_failure => true
40
- @err.should =~ /'staging' is ambiguous/
41
- end
16
+ it_should_behave_like "it takes an environment name"
42
17
  end
@@ -1,42 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "ey recipes apply" do
4
- it_should_behave_like "an integration test"
4
+ given "integration"
5
5
 
6
- before(:all) do
7
- api_scenario "one app, one environment"
6
+ def command_to_run(opts)
7
+ cmd = "recipes apply"
8
+ cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd
8
10
  end
9
11
 
10
- it "works when the environment name is valid" do
11
- ey "recipes apply giblets", :debug => true
12
- @out.should =~ /Uploaded recipes started for giblets/i
12
+ def verify_ran(scenario)
13
+ @out.should =~ /Uploaded recipes started for #{scenario[:environment]}/
13
14
  end
14
15
 
15
- it "runs recipes for the current environment by default" do
16
- ey "recipes apply", :debug => true
17
- @out.should =~ /Uploaded recipes started for giblets/i
18
- end
19
-
20
- it "fails when the environment name is bogus" do
21
- ey "recipes apply typo", :expect_failure => true
22
- @err.should match(/'typo'/)
23
- end
16
+ it_should_behave_like "it takes an environment name"
24
17
  end
25
-
26
- describe "ey recipes apply ENV" do
27
- it_should_behave_like "an integration test"
28
-
29
- before(:all) do
30
- api_scenario "one app, many similarly-named environments"
31
- end
32
-
33
- it "works when given an unambiguous substring" do
34
- ey "recipes apply prod", :debug => true
35
- @out.should =~ /Uploaded recipes started for railsapp_production/
36
- end
37
-
38
- it "complains when given an ambiguous substring" do
39
- ey "recipes apply staging", :hide_err => true, :expect_failure => true
40
- @err.should =~ /'staging' is ambiguous/
41
- end
42
- end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey recipes download" do
4
+ given "integration"
5
+
6
+ after(:each) do
7
+ FileUtils.rm_rf('cookbooks')
8
+ end
9
+
10
+ def command_to_run(opts)
11
+ cmd = "recipes download"
12
+ cmd << " --environment #{opts[:env]}" if opts[:env]
13
+ cmd
14
+ end
15
+
16
+ def verify_ran(scenario)
17
+ @out.should =~ /Recipes downloaded successfully for #{scenario[:environment]}/
18
+ File.read('cookbooks/README').should == "Remove this file to clone an upstream git repository of cookbooks\n"
19
+ end
20
+
21
+ it_should_behave_like "it takes an environment name"
22
+
23
+ it "fails when cookbooks/ already exists" do
24
+ api_scenario "one app, one environment"
25
+ Dir.mkdir("cookbooks")
26
+ ey "recipes download", :expect_failure => true
27
+ @err.should match(/cookbooks.*already exists/i)
28
+ end
29
+ end
@@ -1,40 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "ey recipes upload" do
4
- it_should_behave_like "an integration test"
4
+ given "integration"
5
5
 
6
6
  define_git_repo('+cookbooks') do |git_dir|
7
7
  git_dir.join("cookbooks").mkdir
8
8
  File.open(git_dir.join("cookbooks/file"), "w"){|f| f << "boo" }
9
9
  end
10
-
11
10
  use_git_repo('+cookbooks')
12
11
 
13
- it "posts the recipes to the correct url" do
14
- api_scenario "one app, one environment"
15
- ey "recipes upload giblets", :debug => true
16
-
17
- @out.should =~ /Recipes uploaded successfully for giblets/i
18
- end
19
-
20
- it "errors correctly on bogus env name" do
21
- api_scenario "one app, one environment"
22
- ey "recipes upload bogusenv", :expect_failure => true
23
-
24
- @err.should =~ /No environment named 'bogusenv'/
12
+ def command_to_run(opts)
13
+ cmd = "recipes upload"
14
+ cmd << " --environment #{opts[:env]}" if opts[:env]
15
+ cmd
25
16
  end
26
17
 
27
- it "can infer the environment from the current application" do
28
- api_scenario "one app, one environment"
29
-
30
- ey "recipes upload", :debug => true
31
- @out.should =~ /Recipes uploaded successfully for giblets/i
18
+ def verify_ran(scenario)
19
+ @out.should =~ /Recipes uploaded successfully for #{scenario[:environment]}/
32
20
  end
33
21
 
34
- it "complains when it can't infer the environment from the current application" do
35
- api_scenario "one app, one environment, not linked"
36
-
37
- ey "recipes upload", :debug => true, :expect_failure => true
38
- @err.should =~ /single environment/i
39
- end
22
+ it_should_behave_like "it takes an environment name"
40
23
  end
@@ -1,50 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "ey rollback" do
4
- it_should_behave_like "an integration test"
4
+ given "integration"
5
5
 
6
- before(:all) do
7
- api_scenario "one app, one environment"
6
+ def command_to_run(opts)
7
+ cmd = "rollback"
8
+ cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd
8
10
  end
9
11
 
10
- it "works when the environment name is valid" do
11
- ey "rollback giblets", :debug => true
12
- @out.should match(/rolling back giblets/i)
12
+ def verify_ran(scenario)
13
+ @out.should match(/Rolling back #{scenario[:environment]}/)
13
14
  @err.should be_empty
14
- @ssh_commands.last.should match(/eysd deploy rollback --app rails232app/)
15
+ @ssh_commands.last.should match(/eysd deploy rollback --app #{scenario[:application]}/)
15
16
  end
16
17
 
17
- it "rollback the current environment by default" do
18
- ey "rollback", :debug => true
19
- @out.should match(/rolling back giblets/i)
20
- @err.should be_empty
21
- @ssh_commands.last.should match(/eysd deploy rollback --app rails232app/)
22
- end
23
-
24
- it "fails when the environment name is bogus" do
25
- ey "rollback typo", :expect_failure => true
26
- @err.should match(/'typo'/)
27
- @ssh_commands.should be_empty
28
- end
29
- end
30
-
31
- describe "ey rollback ENV" do
32
- it_should_behave_like "an integration test"
33
-
34
- before(:all) do
35
- api_scenario "one app, many similarly-named environments"
36
- end
37
-
38
- it "works when given an unambiguous substring" do
39
- ey "rollback prod", :debug => true
40
- @out.should match(/Rolling back railsapp_production/i)
41
- @err.should be_empty
42
- @ssh_commands.last.should match(/eysd deploy rollback --app rails232app/)
43
- end
44
-
45
- it "complains when given an ambiguous substring" do
46
- ey "rollback staging", :hide_err => true, :expect_failure => true
47
- @err.should =~ /'staging' is ambiguous/
48
- @ssh_commands.should be_empty
49
- end
18
+ it_should_behave_like "it takes an environment name"
19
+ it_should_behave_like "it invokes eysd"
50
20
  end
data/spec/ey/ssh_spec.rb CHANGED
@@ -3,68 +3,51 @@ require 'spec_helper'
3
3
  print_my_args_ssh = "#!/bin/sh\necho ssh $*"
4
4
 
5
5
  describe "ey ssh" do
6
- it_should_behave_like "an integration test"
6
+ given "integration"
7
7
 
8
8
  before(:all) do
9
9
  api_scenario "one app, two environments"
10
10
  end
11
11
 
12
- it "SSH-es into the right environment" do
13
- ey "ssh giblets", :prepend_to_path => {'ssh' => print_my_args_ssh}
14
- @raw_ssh_commands.should == ["ssh turkey@174.129.198.124"]
15
- end
16
-
17
12
  it "complains if it has no app master" do
18
- ey "ssh bakon", :expect_failure => true
13
+ ey "ssh -e bakon", :expect_failure => true
19
14
  @err.should =~ /'bakon' does not have a master instance/
20
15
  end
21
16
 
22
- it "complains if you give it a bogus environment" do
23
- ey "ssh bogusenv", :prepend_to_path => {'ssh' => print_my_args_ssh}, :expect_failure => true
24
- @raw_ssh_commands.should be_empty
25
- @err.should =~ /bogusenv/
26
- end
27
17
  end
28
18
 
29
19
  describe "ey ssh" do
30
- it_should_behave_like "an integration test"
20
+ given "integration"
31
21
 
32
- it "guesses the environment from the current application" do
33
- api_scenario "one app, one environment"
34
-
35
- ey "ssh", :prepend_to_path => {'ssh' => print_my_args_ssh}
36
- @raw_ssh_commands.should == ["ssh turkey@174.129.198.124"]
22
+ def extra_ey_options
23
+ {:prepend_to_path => {'ssh' => "#!/bin/sh\necho ssh $*"}}
37
24
  end
38
25
 
39
- it "complains when it can't guess the environment and its name isn't specified" do
40
- api_scenario "one app, one environment, not linked"
26
+ def command_to_run(opts)
27
+ cmd = "ssh"
28
+ cmd << " --environment #{opts[:env]}" if opts[:env]
29
+ cmd
30
+ end
41
31
 
42
- ey "ssh", :prepend_to_path => {'ssh' => print_my_args_ssh}, :expect_failure => true
43
- @err.should =~ /single environment/i
32
+ def verify_ran(scenario)
33
+ ssh_target = scenario[:ssh_username] + '@' + scenario[:master_ip]
34
+ @raw_ssh_commands.should == ["ssh #{ssh_target}"]
44
35
  end
36
+
37
+ it_should_behave_like "it takes an environment name"
45
38
  end
46
39
 
47
40
  describe "ey ssh ENV" do
48
- it_should_behave_like "an integration test"
41
+ given "integration"
49
42
 
50
43
  before(:all) do
51
44
  api_scenario "one app, many similarly-named environments"
52
45
  end
53
46
 
54
- it "works when given an unambiguous substring" do
55
- ey "ssh prod", :prepend_to_path => {'ssh' => print_my_args_ssh}
56
- @raw_ssh_commands.should == ["ssh turkey@174.129.198.124"]
57
- end
58
-
59
47
  it "doesn't require you to be in any app's directory if the name is unambiguous" do
60
48
  Dir.chdir(Dir.tmpdir) do
61
- ey "ssh prod", :prepend_to_path => {'ssh' => print_my_args_ssh}
49
+ ey "ssh -e prod", :prepend_to_path => {'ssh' => print_my_args_ssh}
62
50
  @raw_ssh_commands.should == ["ssh turkey@174.129.198.124"]
63
51
  end
64
52
  end
65
-
66
- it "complains when given an ambiguous substring" do
67
- ey "ssh staging", :hide_err => true, :expect_failure => true
68
- @err.should match(/'staging' is ambiguous/)
69
- end
70
53
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey web disable" do
4
+ given "integration"
5
+
6
+ def command_to_run(opts)
7
+ cmd = "web disable"
8
+ cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd
10
+ end
11
+
12
+ def verify_ran(scenario)
13
+ @ssh_commands.should have_command_like(/eysd deploy enable_maintenance_page --app #{scenario[:application]}/)
14
+ end
15
+
16
+ it_should_behave_like "it takes an environment name"
17
+ it_should_behave_like "it invokes eysd"
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey web enable" do
4
+ given "integration"
5
+
6
+ def command_to_run(opts)
7
+ cmd = "web enable"
8
+ cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd
10
+ end
11
+
12
+ def verify_ran(scenario)
13
+ @ssh_commands.should have_command_like(/eysd deploy disable_maintenance_page --app #{scenario[:application]}/)
14
+ end
15
+
16
+ it_should_behave_like "it takes an environment name"
17
+ it_should_behave_like "it invokes eysd"
18
+ end