-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into consider_0_instances_stopped
- Loading branch information
Showing
25 changed files
with
613 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
general_itests/fake_soa_configs_validate/fake_invalid_service/chronos-test-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Invalid with validation error: You must specify a "schedule" in your configuration | ||
--- | ||
chronos_job: | ||
cpus: .1 | ||
mem: 100 |
7 changes: 7 additions & 0 deletions
7
general_itests/fake_soa_configs_validate/fake_invalid_service/marathon-test-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
main: | ||
cpus: .1 | ||
mem: 100 | ||
instances: 1 | ||
env: | ||
FOO: BAR |
5 changes: 5 additions & 0 deletions
5
general_itests/fake_soa_configs_validate/fake_valid_service/chronos-test-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
chronos_job: | ||
cpus: .1 | ||
mem: 100 | ||
schedule: 'R/2015-08-14T10:00:00+00:00/PT10M' |
7 changes: 7 additions & 0 deletions
7
general_itests/fake_soa_configs_validate/fake_valid_service/marathon-test-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
main: | ||
cpus: .1 | ||
mem: 100 | ||
instances: 1 | ||
env: | ||
FOO: BAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2015 Yelp Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from behave import given, when, then | ||
|
||
from paasta_tools.cli.utils import x_mark | ||
from paasta_tools.utils import _run | ||
|
||
|
||
@given(u'a "{service_type}" service') | ||
@given(u'an "{service_type}" service') | ||
def given_service(context, service_type): | ||
context.service = 'fake_%s_service' % service_type | ||
context.soa_dir = 'fake_soa_configs_validate' | ||
|
||
|
||
@when(u'we run paasta validate') | ||
def run_paasta_validate(context): | ||
validate_cmd = ("cli.py validate " | ||
"--yelpsoa-config-root %s " | ||
"--service %s " % (context.soa_dir, context.service)) | ||
context.validate_return_code, context.validate_output = _run(command=validate_cmd) | ||
context.validate_output = context.validate_output.decode('utf-8') | ||
|
||
|
||
@then(u'it should have a return code of "{code:d}"') | ||
def see_expected_return_code(context, code): | ||
print context.validate_output | ||
print context.validate_return_code | ||
assert context.validate_return_code == code | ||
|
||
|
||
@then(u'everything should pass') | ||
def validate_status_all_pass(context): | ||
assert not context.validate_output or x_mark().decode('utf-8') not in context.validate_output | ||
|
||
|
||
@then(u'it should report an error in the output') | ||
def validate_status_something_fail(context): | ||
assert x_mark().decode('utf-8') in context.validate_output | ||
|
||
|
||
@then(u'the output should contain \'{output_string}\'') | ||
def output_contains(context, output_string): | ||
assert output_string in context.validate_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Feature: paasta validate can be used | ||
|
||
Scenario: Running paasta validate against a valid service | ||
Given a "valid" service | ||
When we run paasta validate | ||
Then it should have a return code of "0" | ||
And everything should pass | ||
And the output should contain 'has a valid instance' | ||
|
||
Scenario: Running paasta validate against an invalid service | ||
Given an "invalid" service | ||
When we run paasta validate | ||
Then it should have a return code of "1" | ||
And it should report an error in the output | ||
And the output should contain 'You must specify a "schedule" in your configuration' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.