Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bosh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Steve Wills
bosh
Commits
a1771c43
Commit
a1771c43
authored
Apr 22, 2015
by
Colin Obyrne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes specs by using legacy manifest
[#91451310] Signed-off-by:
Jonathan Barnes
<
jbarnes@pivotal.io
>
parent
97bb569a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
38 deletions
+14
-38
spec/integration/errand/run_errand_failure_spec.rb
spec/integration/errand/run_errand_failure_spec.rb
+1
-1
spec/integration/errand/run_errand_success_spec.rb
spec/integration/errand/run_errand_success_spec.rb
+11
-35
spec/support/deployments.rb
spec/support/deployments.rb
+2
-2
No files found.
spec/integration/errand/run_errand_failure_spec.rb
View file @
a1771c43
...
@@ -82,7 +82,7 @@ describe 'run errand failure', type: :integration, with_tmp_dir: true do
...
@@ -82,7 +82,7 @@ describe 'run errand failure', type: :integration, with_tmp_dir: true do
with_reset_sandbox_before_each
with_reset_sandbox_before_each
let
(
:manifest_hash
)
do
let
(
:manifest_hash
)
do
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
manifest_with_errand
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
legacy_
manifest_with_errand
# Sleep so we have time to cancel it
# Sleep so we have time to cancel it
manifest_hash
[
'jobs'
].
last
[
'properties'
][
'errand1'
][
'sleep_duration_in_seconds'
]
=
5000
manifest_hash
[
'jobs'
].
last
[
'properties'
][
'errand1'
][
'sleep_duration_in_seconds'
]
=
5000
...
...
spec/integration/errand/run_errand_success_spec.rb
View file @
a1771c43
...
@@ -6,7 +6,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
...
@@ -6,7 +6,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
with_reset_sandbox_before_each
with_reset_sandbox_before_each
let
(
:manifest_hash
)
do
let
(
:manifest_hash
)
do
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
manifest_with_errand
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
legacy_
manifest_with_errand
manifest_hash
[
'properties'
]
=
{
manifest_hash
[
'properties'
]
=
{
'errand1'
=>
{
'errand1'
=>
{
'sleep_duration_in_seconds'
=>
60
,
'sleep_duration_in_seconds'
=>
60
,
...
@@ -169,7 +169,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
...
@@ -169,7 +169,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
# When the errand is run, a network update will be required.
# When the errand is run, a network update will be required.
# The network update will fail, by default dummy CPI will
# The network update will fail, by default dummy CPI will
# raise NotSupported, like the aws cpi.
# raise NotSupported, like the aws cpi.
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
manifest_with_errand
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
legacy_
manifest_with_errand
# get rid of the non-errand job, it's not important
# get rid of the non-errand job, it's not important
manifest_hash
[
'jobs'
].
delete
(
manifest_hash
[
'jobs'
][
0
])
manifest_hash
[
'jobs'
].
delete
(
manifest_hash
[
'jobs'
][
0
])
...
@@ -254,16 +254,16 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
...
@@ -254,16 +254,16 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
with_tmp_dir_before_all
with_tmp_dir_before_all
before
(
:all
)
do
before
(
:all
)
do
deploy_simple
(
manifest_hash:
manifest_with_errand
)
deploy_simple
(
manifest_hash:
Bosh
::
Spec
::
Deployments
.
legacy_
manifest_with_errand
)
expect_errands
(
'
errand1
-name'
)
expect_errands
(
'
fake-errand
-name'
)
@output
,
@exit_code
=
bosh_runner
.
run
(
"run errand
errand1
-name --download-logs --logs-dir
#{
@tmp_dir
}
"
,
@output
,
@exit_code
=
bosh_runner
.
run
(
"run errand
fake-errand
-name --download-logs --logs-dir
#{
@tmp_dir
}
"
,
{
return_exit_code:
true
})
{
return_exit_code:
true
})
end
end
it
'shows bin/run stdout and stderr'
do
it
'shows bin/run stdout and stderr'
do
expect
(
@output
).
to
include
(
'
some
-stdout'
)
expect
(
@output
).
to
include
(
'
fake-errand
-stdout'
)
expect
(
@output
).
to
include
(
'
some
-stderr'
)
expect
(
@output
).
to
include
(
'
fake-errand
-stderr'
)
end
end
it
'shows output generated by package script which proves dependent packages are included'
do
it
'shows output generated by package script which proves dependent packages are included'
do
...
@@ -271,14 +271,14 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
...
@@ -271,14 +271,14 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
end
end
it
'downloads errand logs and shows downloaded location'
do
it
'downloads errand logs and shows downloaded location'
do
expect
(
@output
=~
/Logs saved in `(.*
errand1
-name\.0\..*\.tgz)'/
).
to_not
(
be_nil
,
@output
)
expect
(
@output
=~
/Logs saved in `(.*
fake-errand
-name\.0\..*\.tgz)'/
).
to_not
(
be_nil
,
@output
)
logs_file
=
Bosh
::
Spec
::
TarFileInspector
.
new
(
$1
)
logs_file
=
Bosh
::
Spec
::
TarFileInspector
.
new
(
$1
)
expect
(
logs_file
.
file_names
).
to
match_array
(
%w(./errand1/stdout.log ./custom.log)
)
expect
(
logs_file
.
file_names
).
to
match_array
(
%w(./errand1/stdout.log ./custom.log)
)
expect
(
logs_file
.
smallest_file_size
).
to
be
>
0
expect
(
logs_file
.
smallest_file_size
).
to
be
>
0
end
end
it
'returns 0 as exit code from the cli and indicates that errand ran successfully'
do
it
'returns 0 as exit code from the cli and indicates that errand ran successfully'
do
expect
(
@output
).
to
include
(
'Errand `
errand1
-name\' completed successfully (exit code 0)'
)
expect
(
@output
).
to
include
(
'Errand `
fake-errand
-name\' completed successfully (exit code 0)'
)
expect
(
@exit_code
).
to
eq
(
0
)
expect
(
@exit_code
).
to
eq
(
0
)
end
end
end
end
...
@@ -289,41 +289,17 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
...
@@ -289,41 +289,17 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
let
(
:manifest_hash
)
do
let
(
:manifest_hash
)
do
large_property
=
64
.
times
.
inject
(
''
)
{
|
p
|
p
<<
'a'
*
1024
}
# generates 64Kb string
large_property
=
64
.
times
.
inject
(
''
)
{
|
p
|
p
<<
'a'
*
1024
}
# generates 64Kb string
manifest
=
{
'large_property'
=>
large_property
}
manifest
=
{
'large_property'
=>
large_property
}
manifest
.
merge
(
manifest_with_errand
)
manifest
.
merge
(
Bosh
::
Spec
::
Deployments
.
legacy_
manifest_with_errand
)
end
end
it
'deploys successfully'
do
it
'deploys successfully'
do
deploy_simple
(
manifest_hash:
manifest_hash
)
deploy_simple
(
manifest_hash:
manifest_hash
)
_
,
exit_code
=
bosh_runner
.
run
(
'run errand
errand1
-name'
,
{
return_exit_code:
true
})
_
,
exit_code
=
bosh_runner
.
run
(
'run errand
fake-errand
-name'
,
{
return_exit_code:
true
})
expect
(
exit_code
).
to
eq
(
0
)
expect
(
exit_code
).
to
eq
(
0
)
end
end
end
end
def
manifest_with_errand
manifest_hash
=
Bosh
::
Spec
::
Deployments
.
legacy_simple_manifest
manifest_hash
[
'jobs'
].
first
[
'instances'
]
=
1
manifest_hash
[
'jobs'
]
<<
{
'name'
=>
'errand1-name'
,
'template'
=>
'errand1'
,
'lifecycle'
=>
'errand'
,
'resource_pool'
=>
'a'
,
'instances'
=>
1
,
'networks'
=>
[{
'name'
=>
'a'
}],
'properties'
=>
{
'errand1'
=>
{
'exit_code'
=>
0
,
'stdout'
=>
'some-stdout'
,
'stderr'
=>
'some-stderr'
,
'run_package_file'
=>
true
,
},
},
}
manifest_hash
end
def
expect_errands
(
*
expected_errands
)
def
expect_errands
(
*
expected_errands
)
output
,
_
=
bosh_runner
.
run
(
'errands'
)
output
,
_
=
bosh_runner
.
run
(
'errands'
)
expected_errands
.
each
do
|
errand
|
expected_errands
.
each
do
|
errand
|
...
...
spec/support/deployments.rb
View file @
a1771c43
...
@@ -107,8 +107,8 @@ module Bosh::Spec
...
@@ -107,8 +107,8 @@ module Bosh::Spec
})
})
end
end
def
self
.
manifest_with_errand
def
self
.
legacy_
manifest_with_errand
manifest
=
simple_manifest
.
merge
(
manifest
=
legacy_
simple_manifest
.
merge
(
'name'
=>
'errand'
'name'
=>
'errand'
)
)
manifest
[
'resource_pools'
].
first
.
delete
(
'size'
)
manifest
[
'resource_pools'
].
first
.
delete
(
'size'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment