bosh-bootstrap 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +1 -1
- data/ChangeLog.md +106 -87
- data/Gemfile +1 -0
- data/bosh-bootstrap.gemspec +2 -2
- data/lib/bosh-bootstrap/cli/commands/deploy.rb +3 -3
- data/lib/bosh-bootstrap/microbosh_providers/aws.rb +1 -5
- data/lib/bosh-bootstrap/microbosh_providers/base.rb +4 -0
- data/lib/bosh-bootstrap/microbosh_providers/openstack.rb +57 -12
- data/lib/bosh-bootstrap/network.rb +4 -5
- data/lib/bosh-bootstrap/network_providers/aws.rb +5 -9
- data/lib/bosh-bootstrap/network_providers/dummy.rb +1 -1
- data/lib/bosh-bootstrap/network_providers/openstack.rb +6 -18
- data/lib/bosh-bootstrap/version.rb +1 -1
- data/spec/assets/microbosh_yml/micro_bosh.aws_ec2.us-west-2a.yml +1 -5
- data/spec/assets/microbosh_yml/micro_bosh.aws_ec2.yml +1 -5
- data/spec/assets/microbosh_yml/micro_bosh.aws_vpc.yml +1 -5
- data/spec/assets/microbosh_yml/micro_bosh.openstack.boot_from_volume.yml +43 -0
- data/spec/assets/microbosh_yml/micro_bosh.openstack.neutron_manual.yml +43 -0
- data/spec/assets/microbosh_yml/{micro_bosh.openstack.yml → micro_bosh.openstack.neutron_vip.yml} +12 -13
- data/spec/assets/microbosh_yml/micro_bosh.openstack.nova_vip.yml +41 -0
- data/spec/spec_helper.rb +3 -3
- data/spec/support/rspec-fire.rb +9 -0
- data/spec/unit/commands/deploy_spec.rb +73 -60
- data/spec/unit/key_pair_spec.rb +3 -3
- data/spec/unit/microbosh_providers/openstack_spec.rb +87 -18
- data/spec/unit/microbosh_spec.rb +2 -2
- data/spec/unit/network_providers/aws_spec.rb +5 -9
- data/spec/unit/network_providers/openstack_spec.rb +5 -9
- data/spec/unit/network_spec.rb +5 -6
- metadata +28 -20
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
name: test-bosh
|
3
|
+
logging:
|
4
|
+
level: DEBUG
|
5
|
+
network:
|
6
|
+
type: manual
|
7
|
+
ip: 10.10.10.3
|
8
|
+
cloud_properties:
|
9
|
+
net_id: 7b8788eb-b49e-4424-9065-75a6b07094ea
|
10
|
+
resources:
|
11
|
+
persistent_disk: 16384
|
12
|
+
cloud_properties:
|
13
|
+
instance_type: m1.medium
|
14
|
+
cloud:
|
15
|
+
plugin: openstack
|
16
|
+
properties:
|
17
|
+
openstack:
|
18
|
+
auth_url: http://10.0.0.2:5000/v2.0/tokens
|
19
|
+
username: USER
|
20
|
+
api_key: PASSWORD
|
21
|
+
tenant: TENANT
|
22
|
+
region: REGION
|
23
|
+
default_security_groups:
|
24
|
+
- ssh
|
25
|
+
- dns_server
|
26
|
+
- bosh
|
27
|
+
default_key_name: test-bosh
|
28
|
+
private_key: ~/.microbosh/ssh/test-bosh
|
29
|
+
boot_from_volume: false
|
30
|
+
apply_spec:
|
31
|
+
agent:
|
32
|
+
blobstore:
|
33
|
+
address: 10.10.10.3
|
34
|
+
nats:
|
35
|
+
address: 10.10.10.3
|
36
|
+
properties:
|
37
|
+
director:
|
38
|
+
max_threads: 3
|
39
|
+
hm:
|
40
|
+
resurrector_enabled: true
|
41
|
+
ntp:
|
42
|
+
- 0.north-america.pool.ntp.org
|
43
|
+
- 1.north-america.pool.ntp.org
|
data/spec/assets/microbosh_yml/{micro_bosh.openstack.yml → micro_bosh.openstack.neutron_vip.yml}
RENAMED
@@ -1,33 +1,32 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
2
|
name: test-bosh
|
3
|
-
logging:
|
3
|
+
logging:
|
4
4
|
level: DEBUG
|
5
5
|
network:
|
6
6
|
type: dynamic
|
7
7
|
vip: 1.2.3.4
|
8
|
-
|
8
|
+
cloud_properties:
|
9
|
+
net_id: 7b8788eb-b49e-4424-9065-75a6b07094ea
|
10
|
+
resources:
|
9
11
|
persistent_disk: 16384
|
10
|
-
cloud_properties:
|
12
|
+
cloud_properties:
|
11
13
|
instance_type: m1.medium
|
12
|
-
cloud:
|
14
|
+
cloud:
|
13
15
|
plugin: openstack
|
14
|
-
properties:
|
15
|
-
openstack:
|
16
|
+
properties:
|
17
|
+
openstack:
|
16
18
|
auth_url: http://10.0.0.2:5000/v2.0/tokens
|
17
19
|
username: USER
|
18
20
|
api_key: PASSWORD
|
19
21
|
tenant: TENANT
|
20
22
|
region: REGION
|
21
|
-
default_security_groups:
|
23
|
+
default_security_groups:
|
22
24
|
- ssh
|
23
25
|
- dns_server
|
24
|
-
-
|
25
|
-
- bosh_nats_server
|
26
|
-
- bosh_blobstore
|
27
|
-
- bosh_director
|
28
|
-
- bosh_registry
|
26
|
+
- bosh
|
29
27
|
default_key_name: test-bosh
|
30
28
|
private_key: ~/.microbosh/ssh/test-bosh
|
29
|
+
boot_from_volume: false
|
31
30
|
apply_spec:
|
32
31
|
agent:
|
33
32
|
blobstore:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
name: test-bosh
|
3
|
+
logging:
|
4
|
+
level: DEBUG
|
5
|
+
network:
|
6
|
+
type: dynamic
|
7
|
+
vip: 1.2.3.4
|
8
|
+
resources:
|
9
|
+
persistent_disk: 16384
|
10
|
+
cloud_properties:
|
11
|
+
instance_type: m1.medium
|
12
|
+
cloud:
|
13
|
+
plugin: openstack
|
14
|
+
properties:
|
15
|
+
openstack:
|
16
|
+
auth_url: http://10.0.0.2:5000/v2.0/tokens
|
17
|
+
username: USER
|
18
|
+
api_key: PASSWORD
|
19
|
+
tenant: TENANT
|
20
|
+
region: REGION
|
21
|
+
default_security_groups:
|
22
|
+
- ssh
|
23
|
+
- dns_server
|
24
|
+
- bosh
|
25
|
+
default_key_name: test-bosh
|
26
|
+
private_key: ~/.microbosh/ssh/test-bosh
|
27
|
+
boot_from_volume: false
|
28
|
+
apply_spec:
|
29
|
+
agent:
|
30
|
+
blobstore:
|
31
|
+
address: 1.2.3.4
|
32
|
+
nats:
|
33
|
+
address: 1.2.3.4
|
34
|
+
properties:
|
35
|
+
director:
|
36
|
+
max_threads: 3
|
37
|
+
hm:
|
38
|
+
resurrector_enabled: true
|
39
|
+
ntp:
|
40
|
+
- 0.north-america.pool.ntp.org
|
41
|
+
- 1.north-america.pool.ntp.org
|
data/spec/spec_helper.rb
CHANGED
@@ -29,13 +29,13 @@ end
|
|
29
29
|
def files_match(filename, expected_filename)
|
30
30
|
file = File.read(filename)
|
31
31
|
expected_file = File.read(expected_filename)
|
32
|
-
file.
|
32
|
+
expect(file).to eq(expected_file)
|
33
33
|
end
|
34
34
|
|
35
35
|
def yaml_files_match(filename, expected_filename)
|
36
36
|
yaml = YAML.load_file(filename)
|
37
37
|
expected_yaml = YAML.load_file(expected_filename)
|
38
|
-
yaml.
|
38
|
+
expect(yaml).to eq(expected_yaml)
|
39
39
|
end
|
40
40
|
|
41
41
|
def setup_home_dir
|
@@ -56,7 +56,7 @@ RSpec.configure do |c|
|
|
56
56
|
setup_home_dir
|
57
57
|
end
|
58
58
|
|
59
|
-
c.
|
59
|
+
c.color = true
|
60
60
|
end
|
61
61
|
|
62
62
|
def get_tmp_file_path(content)
|
@@ -22,43 +22,51 @@ describe Bosh::Bootstrap::Cli::Commands::Deploy do
|
|
22
22
|
# * create_microbosh_manifest
|
23
23
|
# * microbosh_deploy
|
24
24
|
describe "aws" do
|
25
|
-
|
25
|
+
before do
|
26
26
|
setting "provider.name", "aws"
|
27
27
|
setting "key_pair.name", "test-bosh"
|
28
28
|
setting "key_pair.private_key", "PRIVATE"
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
Cyoi::Cli::Provider
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
31
|
+
it "deploy creates provisions IP address micro_bosh.yml, discovers/downloads stemcell/AMI, runs 'bosh micro deploy'" do
|
32
|
+
# select_provider
|
33
|
+
cli_provider = instance_double("Cyoi::Cli::Provider")
|
34
|
+
expect(cli_provider).to receive(:execute!)
|
35
|
+
expect(Cyoi::Cli::Provider).to receive(:new).with([settings_dir]).and_return(cli_provider)
|
36
|
+
|
37
|
+
cyoi_provider_client = instance_double("Cyoi::Providers::Clients::AwsProviderClient")
|
38
|
+
expect(cyoi_provider_client).to receive(:create_security_group).exactly(3).times
|
39
|
+
expect(Cyoi::Providers).to receive(:provider_client).with("name" => "aws").and_return(cyoi_provider_client)
|
40
|
+
|
41
|
+
# select_or_provision_public_networking
|
42
|
+
address = instance_double("Cyoi::Cli::Address")
|
43
|
+
expect(address).to receive(:execute!)
|
44
|
+
expect(Cyoi::Cli::Address).to receive(:new).with([settings_dir]).and_return(address)
|
45
|
+
|
46
|
+
# microbosh_provider & select_public_image_or_download_stemcell
|
47
|
+
microbosh_provider = instance_double("Bosh::Bootstrap::MicroboshProviders::AWS")
|
48
|
+
expect(microbosh_provider).to receive(:stemcell).exactly(1).times.and_return("")
|
49
|
+
expect(microbosh_provider).to receive(:stemcell).exactly(1).times.and_return("ami-123456")
|
50
|
+
expect(cmd).to receive(:microbosh_provider).and_return(microbosh_provider).exactly(3).times
|
51
|
+
|
52
|
+
# setup_keypair
|
53
|
+
key_pair = instance_double(Cyoi::Cli::KeyPair)
|
54
|
+
expect(key_pair).to receive(:execute!)
|
55
|
+
expect(Cyoi::Cli::KeyPair).to receive(:new).with(["test-bosh", settings_dir]).and_return(key_pair)
|
56
|
+
|
57
|
+
keypair = instance_double(Bosh::Bootstrap::KeyPair)
|
58
|
+
expect(keypair).to receive(:execute!)
|
59
|
+
expect(keypair).to receive(:path).and_return(home_file(".microbosh/ssh/test-bosh"))
|
60
|
+
expect(Bosh::Bootstrap::KeyPair).to receive(:new).with(settings_dir, "test-bosh", "PRIVATE").and_return(keypair)
|
61
|
+
|
62
|
+
# perform_microbosh_deploy
|
63
|
+
microbosh = instance_double(Bosh::Bootstrap::Microbosh)
|
64
|
+
expect(microbosh).to receive(:deploy)
|
65
|
+
expect(Bosh::Bootstrap::Microbosh).to receive(:new).with(settings_dir, microbosh_provider).and_return(microbosh)
|
59
66
|
|
60
67
|
capture_stdout { cmd.perform }
|
61
68
|
end
|
69
|
+
|
62
70
|
end
|
63
71
|
|
64
72
|
describe "openstack" do
|
@@ -67,37 +75,42 @@ describe Bosh::Bootstrap::Cli::Commands::Deploy do
|
|
67
75
|
setting "key_pair.name", "test-bosh"
|
68
76
|
setting "key_pair.private_key", "PRIVATE"
|
69
77
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
Cyoi::Cli::Address
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
microbosh_provider
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
Bosh::Bootstrap::
|
78
|
+
# select_provider
|
79
|
+
cli_provider = instance_double("Cyoi::Cli::Provider")
|
80
|
+
expect(cli_provider).to receive(:execute!)
|
81
|
+
expect(Cyoi::Cli::Provider).to receive(:new).with([settings_dir]).and_return(cli_provider)
|
82
|
+
|
83
|
+
cyoi_provider_client = instance_double("Cyoi::Providers::Clients::OpenStackProviderClient")
|
84
|
+
expect(cyoi_provider_client).to receive(:create_security_group).exactly(3).times
|
85
|
+
expect(Cyoi::Providers).to receive(:provider_client).with("name" => "openstack").and_return(cyoi_provider_client)
|
86
|
+
|
87
|
+
# select_or_provision_public_networking
|
88
|
+
address = instance_double("Cyoi::Cli::Address")
|
89
|
+
expect(address).to receive(:execute!)
|
90
|
+
expect(Cyoi::Cli::Address).to receive(:new).with([settings_dir]).and_return(address)
|
91
|
+
|
92
|
+
# microbosh_provider & select_public_image_or_download_stemcell
|
93
|
+
microbosh_provider = instance_double("Bosh::Bootstrap::MicroboshProviders::OpenStack")
|
94
|
+
expect(microbosh_provider).to receive(:stemcell).exactly(1).times.and_return("")
|
95
|
+
expect(microbosh_provider).to receive(:stemcell).exactly(1).times.and_return("openstack.tgz")
|
96
|
+
expect(cmd).to receive(:microbosh_provider).and_return(microbosh_provider).exactly(3).times
|
97
|
+
|
98
|
+
# setup_keypair
|
99
|
+
key_pair = instance_double(Cyoi::Cli::KeyPair)
|
100
|
+
expect(key_pair).to receive(:execute!)
|
101
|
+
expect(Cyoi::Cli::KeyPair).to receive(:new).with(["test-bosh", settings_dir]).and_return(key_pair)
|
102
|
+
|
103
|
+
keypair = instance_double(Bosh::Bootstrap::KeyPair)
|
104
|
+
expect(keypair).to receive(:execute!)
|
105
|
+
expect(keypair).to receive(:path).and_return(home_file(".microbosh/ssh/test-bosh"))
|
106
|
+
expect(Bosh::Bootstrap::KeyPair).to receive(:new).with(settings_dir, "test-bosh", "PRIVATE").and_return(keypair)
|
107
|
+
|
108
|
+
# perform_microbosh_deploy
|
109
|
+
microbosh = instance_double(Bosh::Bootstrap::Microbosh)
|
110
|
+
expect(microbosh).to receive(:deploy)
|
111
|
+
expect(Bosh::Bootstrap::Microbosh).to receive(:new).with(settings_dir, microbosh_provider).and_return(microbosh)
|
99
112
|
|
100
113
|
capture_stdout { cmd.perform }
|
101
114
|
end
|
102
115
|
end
|
103
|
-
end
|
116
|
+
end
|
data/spec/unit/key_pair_spec.rb
CHANGED
@@ -7,9 +7,9 @@ describe Bosh::Bootstrap::KeyPair do
|
|
7
7
|
|
8
8
|
it "creates local private key file" do
|
9
9
|
setup_home_dir
|
10
|
-
File.
|
10
|
+
expect(File.exists?(home_file(".microbosh", "ssh", "keyname"))).to eq false
|
11
11
|
subject.execute!
|
12
12
|
keyfile = home_file(".microbosh", "ssh", "keyname")
|
13
|
-
File.read(keyfile).
|
13
|
+
expect(File.read(keyfile)).to eq "PRIVATE"
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -6,23 +6,92 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
|
|
6
6
|
|
7
7
|
let(:microbosh_yml) { File.expand_path("~/.microbosh/deployments/micro_bosh.yml")}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
context "creates micro_bosh.yml manifest" do
|
10
|
+
it "on nova with floating IP" do
|
11
|
+
setting "provider.name", "openstack"
|
12
|
+
setting "provider.credentials.openstack_auth_url", "http://10.0.0.2:5000/v2.0/tokens"
|
13
|
+
setting "provider.credentials.openstack_username", "USER"
|
14
|
+
setting "provider.credentials.openstack_api_key", "PASSWORD"
|
15
|
+
setting "provider.credentials.openstack_tenant", "TENANT"
|
16
|
+
setting "provider.credentials.openstack_region", "REGION"
|
17
|
+
setting "address.ip", "1.2.3.4"
|
18
|
+
setting "key_pair.path", "~/.microbosh/ssh/test-bosh"
|
19
|
+
setting "bosh.name", "test-bosh"
|
20
|
+
setting "bosh.salted_password", "salted_password"
|
21
|
+
setting "bosh.persistent_disk", 16384
|
22
|
+
|
23
|
+
subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
|
24
|
+
|
25
|
+
subject.create_microbosh_yml(settings)
|
26
|
+
File.should be_exists(microbosh_yml)
|
27
|
+
yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.nova_vip.yml"))
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
it "on neutron with public gateway & floating IP" do
|
32
|
+
setting "provider.name", "openstack"
|
33
|
+
setting "provider.credentials.openstack_auth_url", "http://10.0.0.2:5000/v2.0/tokens"
|
34
|
+
setting "provider.credentials.openstack_username", "USER"
|
35
|
+
setting "provider.credentials.openstack_api_key", "PASSWORD"
|
36
|
+
setting "provider.credentials.openstack_tenant", "TENANT"
|
37
|
+
setting "provider.credentials.openstack_region", "REGION"
|
38
|
+
setting "address.subnet_id", "7b8788eb-b49e-4424-9065-75a6b07094ea"
|
39
|
+
setting "address.pool_name", "INTERNET"
|
40
|
+
setting "address.ip", "1.2.3.4" # network.vip
|
41
|
+
setting "key_pair.path", "~/.microbosh/ssh/test-bosh"
|
42
|
+
setting "bosh.name", "test-bosh"
|
43
|
+
setting "bosh.salted_password", "salted_password"
|
44
|
+
setting "bosh.persistent_disk", 16384
|
45
|
+
|
46
|
+
subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
|
47
|
+
|
48
|
+
subject.create_microbosh_yml(settings)
|
49
|
+
File.should be_exists(microbosh_yml)
|
50
|
+
yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.neutron_vip.yml"))
|
51
|
+
end
|
52
|
+
|
53
|
+
it "on neutron with internal static IP only" do
|
54
|
+
setting "provider.name", "openstack"
|
55
|
+
setting "provider.credentials.openstack_auth_url", "http://10.0.0.2:5000/v2.0/tokens"
|
56
|
+
setting "provider.credentials.openstack_username", "USER"
|
57
|
+
setting "provider.credentials.openstack_api_key", "PASSWORD"
|
58
|
+
setting "provider.credentials.openstack_tenant", "TENANT"
|
59
|
+
setting "provider.credentials.openstack_region", "REGION"
|
60
|
+
setting "address.subnet_id", "7b8788eb-b49e-4424-9065-75a6b07094ea"
|
61
|
+
setting "address.ip", "10.10.10.3" # network.ip
|
62
|
+
setting "key_pair.path", "~/.microbosh/ssh/test-bosh"
|
63
|
+
setting "bosh.name", "test-bosh"
|
64
|
+
setting "bosh.salted_password", "salted_password"
|
65
|
+
setting "bosh.persistent_disk", 16384
|
66
|
+
|
67
|
+
subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
|
68
|
+
|
69
|
+
subject.create_microbosh_yml(settings)
|
70
|
+
File.should be_exists(microbosh_yml)
|
71
|
+
yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.neutron_manual.yml"))
|
72
|
+
end
|
73
|
+
|
74
|
+
it "boot from volume" do
|
75
|
+
setting "provider.name", "openstack"
|
76
|
+
setting "provider.credentials.openstack_auth_url", "http://10.0.0.2:5000/v2.0/tokens"
|
77
|
+
setting "provider.credentials.openstack_username", "USER"
|
78
|
+
setting "provider.credentials.openstack_api_key", "PASSWORD"
|
79
|
+
setting "provider.credentials.openstack_tenant", "TENANT"
|
80
|
+
setting "provider.credentials.openstack_region", "REGION"
|
81
|
+
setting "address.subnet_id", "7b8788eb-b49e-4424-9065-75a6b07094ea"
|
82
|
+
setting "address.ip", "10.10.10.3" # network.ip
|
83
|
+
setting "key_pair.path", "~/.microbosh/ssh/test-bosh"
|
84
|
+
setting "bosh.name", "test-bosh"
|
85
|
+
setting "bosh.salted_password", "salted_password"
|
86
|
+
setting "bosh.persistent_disk", 16384
|
87
|
+
|
88
|
+
setting "provider.options.boot_from_volume", true
|
89
|
+
|
90
|
+
subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
|
91
|
+
|
92
|
+
subject.create_microbosh_yml(settings)
|
93
|
+
File.should be_exists(microbosh_yml)
|
94
|
+
yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.boot_from_volume.yml"))
|
95
|
+
end
|
27
96
|
end
|
28
97
|
end
|
data/spec/unit/microbosh_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Bosh::Bootstrap::Microbosh do
|
|
6
6
|
let(:path_or_ami) { "/path/to/stemcell.tgz" }
|
7
7
|
let(:base_path) { File.expand_path("~/.microbosh") }
|
8
8
|
let(:settings_dir) { base_path }
|
9
|
-
let(:microbosh_provider) {
|
9
|
+
let(:microbosh_provider) { instance_double("Bosh::Bootstrap::MicroboshProviders::AWS", create_microbosh_yml: {}) }
|
10
10
|
subject { Bosh::Bootstrap::Microbosh.new(base_path, microbosh_provider) }
|
11
11
|
|
12
12
|
it "deploys new microbosh" do
|
@@ -24,4 +24,4 @@ describe Bosh::Bootstrap::Microbosh do
|
|
24
24
|
xit "re-deploys failed microbosh deployment" do
|
25
25
|
subject.deploy
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
@@ -6,25 +6,21 @@ require "bosh-bootstrap/network_providers/aws"
|
|
6
6
|
describe Bosh::Bootstrap::NetworkProviders::AWS do
|
7
7
|
include Bosh::Bootstrap::Cli::Helpers::Settings
|
8
8
|
|
9
|
-
let(:
|
10
|
-
subject { Bosh::Bootstrap::NetworkProviders::AWS.new(
|
9
|
+
let(:cyoi_provider_client) { instance_double("Cyoi::Providers::Clients::AwsProviderClient") }
|
10
|
+
subject { Bosh::Bootstrap::NetworkProviders::AWS.new(cyoi_provider_client) }
|
11
11
|
|
12
12
|
it "is registered" do
|
13
|
-
Bosh::Bootstrap::NetworkProviders.provider_class("aws").
|
13
|
+
expect(Bosh::Bootstrap::NetworkProviders.provider_class("aws")).to eq(subject.class)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "creates security groups it needs" do
|
17
17
|
expected_groups = [
|
18
18
|
["ssh", "ssh", ports: 22],
|
19
19
|
["dns_server", "dns_server", ports: { protocol: "udp", ports: (53..53) }],
|
20
|
-
["
|
21
|
-
["bosh_agent_https", "bosh_agent_https", ports: 6868],
|
22
|
-
["bosh_blobstore", "bosh_blobstore", ports: 25250],
|
23
|
-
["bosh_director", "bosh_director", ports: 25555],
|
24
|
-
["bosh_registry", "bosh_registry", ports: 25777],
|
20
|
+
["bosh", "bosh", ports: [4222, 6868, 25250, 25555, 25777]]
|
25
21
|
]
|
26
22
|
expected_groups.each do |security_group_name, description, ports|
|
27
|
-
|
23
|
+
expect(cyoi_provider_client).to receive(:create_security_group).with(security_group_name, description, ports)
|
28
24
|
end
|
29
25
|
subject.perform
|
30
26
|
end
|
@@ -5,7 +5,7 @@ require "bosh-bootstrap/network_providers/openstack"
|
|
5
5
|
describe Bosh::Bootstrap::NetworkProviders::OpenStack do
|
6
6
|
include Bosh::Bootstrap::Cli::Helpers::Settings
|
7
7
|
|
8
|
-
let(:provider_client) {
|
8
|
+
let(:provider_client) { instance_double("Cyoi::Providers::Clients::OpenStackProviderClient") }
|
9
9
|
subject { Bosh::Bootstrap::NetworkProviders::OpenStack.new(provider_client) }
|
10
10
|
|
11
11
|
it "is registered" do
|
@@ -14,16 +14,12 @@ describe Bosh::Bootstrap::NetworkProviders::OpenStack do
|
|
14
14
|
|
15
15
|
it "creates security groups it needs" do
|
16
16
|
expected_groups = [
|
17
|
-
["ssh", "ssh",
|
18
|
-
["dns_server", "dns_server",
|
19
|
-
["
|
20
|
-
["bosh_agent_https", "bosh_agent_https", ports: 6868],
|
21
|
-
["bosh_blobstore", "bosh_blobstore", ports: 25250],
|
22
|
-
["bosh_director", "bosh_director", ports: 25555],
|
23
|
-
["bosh_registry", "bosh_registry", ports: 25777],
|
17
|
+
["ssh", "ssh", 22],
|
18
|
+
["dns_server", "dns_server", { protocol: "udp", ports: (53..53) }],
|
19
|
+
["bosh", "bosh", [4222, 6868, 25250, 25555, 25777]]
|
24
20
|
]
|
25
21
|
expected_groups.each do |security_group_name, description, ports|
|
26
|
-
provider_client.
|
22
|
+
expect(provider_client).to receive(:create_security_group).with(security_group_name, description, ports)
|
27
23
|
end
|
28
24
|
subject.perform
|
29
25
|
end
|
data/spec/unit/network_spec.rb
CHANGED
@@ -3,17 +3,16 @@ require "bosh-bootstrap/network"
|
|
3
3
|
describe Bosh::Bootstrap::Network do
|
4
4
|
include Bosh::Bootstrap::Cli::Helpers::Settings
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:vsphere_provider_client) { stub() }
|
6
|
+
let(:aws_cyoi_provider_client) { instance_double("Cyoi::Providers::Clients::AwsProviderClient") }
|
8
7
|
|
9
8
|
it "uses NetworkProvider if available" do
|
10
|
-
network = Bosh::Bootstrap::Network.new("aws",
|
11
|
-
|
9
|
+
network = Bosh::Bootstrap::Network.new("aws", aws_cyoi_provider_client)
|
10
|
+
expect(aws_cyoi_provider_client).to receive(:create_security_group).exactly(3).times
|
12
11
|
network.deploy
|
13
12
|
end
|
14
13
|
|
15
14
|
it "does nothing if no NetworkProvider for the infrastructure" do
|
16
|
-
network = Bosh::Bootstrap::Network.new("vsphere",
|
15
|
+
network = Bosh::Bootstrap::Network.new("vsphere", nil)
|
17
16
|
network.deploy
|
18
17
|
end
|
19
|
-
end
|
18
|
+
end
|