-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ansible test refactor (preparing for custom tests) (#2274)
Merged PR #2274.
- Loading branch information
1 parent
e705535
commit 37b9255
Showing
10 changed files
with
93 additions
and
23 deletions.
There are no files selected for viewing
Submodule ansible
updated
from 11fb11 to 6d6a99
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2017 Google 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. | ||
|
||
module Provider | ||
module Ansible | ||
# Contains all information about Ansible tests. | ||
class Tests < Api::Object | ||
attr_reader :has_autogenerated_test | ||
attr_reader :tests | ||
def validate | ||
check :has_autogenerated_test, type: :boolean, default: true | ||
check :tests, type: Array, item_type: Provider::Ansible::Test, default: [] | ||
|
||
return unless @has_autogenerated_test | ||
|
||
tests << Test.new('autogen', 'templates/ansible/integration_test.erb') | ||
end | ||
end | ||
|
||
# Contains information about an individual Ansible test. | ||
class Test < Api:: Object | ||
# The filename of the Ansible test playbook (without extension) | ||
attr_reader :name | ||
|
||
# The path of the test file / test template in MM. | ||
attr_reader :path | ||
|
||
def initialize(name, path) | ||
@name = name | ||
@path = path | ||
end | ||
|
||
def validate | ||
check :name, required: true, type: String | ||
check :path, required: true, type: String | ||
end | ||
end | ||
end | ||
end |
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,2 @@ | ||
--- | ||
<%= ansible_style_yaml(object.tests.tests.map { |t| { "include_tasks" => "#{t.name}.yml" } }) -%> |