-
Notifications
You must be signed in to change notification settings - Fork 21
(MODULES-2391) Create Automated Tests For sqlserver_instance 2015-08-26 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cowofevil
merged 7 commits into
puppetlabs:master
from
phongdly:MODULES-2391/SQLSERVER-Create_Automated_Tested_for_sqlserver-instance
Aug 26, 2015
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ce0eb22
(MODULES-2391) SQLSERVER - Create Automated Tests For sqlserver_insta…
phongdly 22057c0
(MODULES-2391) change inst_name to be same value
phongdly ccd1f3b
(MODULES-2391) skip test create instance with only AS feature
phongdly 03bf779
(MODULES-2391) removed ensure_value
phongdly cb9c607
(MODULES-2391) remove 'remove_sql_features' method
phongdly 96c854d
(MODULES-2391) add testrail context
phongdly d2ba03b
(MODULES-2391) added missing meta-tag
phongdly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,123 @@ | ||
require 'spec_helper_acceptance' | ||
require 'securerandom' | ||
require 'erb' | ||
|
||
host = find_only_one("sql_host") | ||
inst_name = ("MSSQL" + SecureRandom.hex(4)).upcase | ||
|
||
describe "sqlserver_instance", :node => host do | ||
version = host['sql_version'].to_s | ||
|
||
def ensure_sqlserver_instance(host, features, inst_name, ensure_val = 'present') | ||
manifest = <<-MANIFEST | ||
sqlserver_instance{'#{inst_name}': | ||
name => '#{inst_name}', | ||
ensure => <%= ensure_val %>, | ||
source => 'H:', | ||
features => [ <%= mssql_features %> ], | ||
sql_sysadmin_accounts => ['Administrator'], | ||
agt_svc_account => 'Administrator', | ||
agt_svc_password => 'Qu@lity!', | ||
} | ||
MANIFEST | ||
|
||
mssql_features = features.map{ |x| "'#{x}'"}.join(', ') | ||
|
||
pp = ERB.new(manifest).result(binding) | ||
|
||
apply_manifest_on(host, pp) do |r| | ||
expect(r.stderr).not_to match(/Error/i) | ||
end | ||
end | ||
|
||
context "server_url =>", {:testrail => ['88978', '89028', '89031', '89043', '89061']} do | ||
|
||
features = ['SQL', 'SQLEngine', 'Replication', 'FullText', 'DQ'] | ||
|
||
before(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
after(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
it "create #{inst_name} instance" do | ||
ensure_sqlserver_instance(host, features, inst_name) | ||
|
||
validate_sql_install(host, {:version => version}) do |r| | ||
expect(r.stdout).to match(/#{Regexp.new(inst_name)}/) | ||
end | ||
end | ||
|
||
it "remove #{inst_name} instance" do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
|
||
validate_sql_install(host, {:version => version}) do |r| | ||
expect(r.stdout).not_to match(/#{Regexp.new(inst_name)}/) | ||
end | ||
end | ||
end | ||
|
||
context "server_url =>", {:testrail => ['89032']} do | ||
features = ['SQL'] | ||
|
||
before(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
after(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
it "create #{inst_name} instance with only one SQL feature" do | ||
ensure_sqlserver_instance(host, features, inst_name) | ||
|
||
validate_sql_install(host, {:version => version}) do |r| | ||
expect(r.stdout).to match(/#{Regexp.new(inst_name)}/) | ||
end | ||
end | ||
end | ||
|
||
context "server_url =>", {:testrail => ['89034']} do | ||
features = ['RS'] | ||
|
||
before(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
after(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
it "create #{inst_name} instance with only one RS feature" do | ||
ensure_sqlserver_instance(host, features, inst_name) | ||
|
||
validate_sql_install(host, {:version => version}) do |r| | ||
expect(r.stdout).to match(/#{Regexp.new(inst_name)}/) | ||
end | ||
end | ||
end | ||
|
||
context "server_url =>", {:testrail => ['89033']} do | ||
features = ['AS'] | ||
|
||
before(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
after(:all) do | ||
ensure_sqlserver_instance(host, features, inst_name, 'absent') | ||
end | ||
|
||
#skip below test due to ticket MODULES-2379, when the ticket was resolved | ||
# will change xit to it | ||
xit "create #{inst_name} instance with only one AS feature" do | ||
ensure_sqlserver_instance(host, features, inst_name) | ||
|
||
validate_sql_install(host, {:version => version}) do |r| | ||
expect(r.stdout).to match(/#{Regexp.new(inst_name)}/) | ||
end | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server_url tells me nothing about what this should be doing, can we go back and specify the context in clear text I it will make debugging failures a lot more clear.