@@ -41,14 +41,14 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
41
41
# Create new database
42
42
ensure_sqlserver_database ( host )
43
43
end
44
- before ( :each ) do
44
+ before ( :each ) do
45
45
@new_sql_login = "Login" + SecureRandom . hex ( 2 )
46
46
@db_user = "DBuser" + SecureRandom . hex ( 2 )
47
47
end
48
48
49
49
after ( :all ) do
50
50
# remove the newly created instance
51
- # ensure_sqlserver_database(host, 'absent')
51
+ ensure_sqlserver_database ( host , 'absent' )
52
52
end
53
53
54
54
it "Create database user with optional default_schema" do
@@ -73,7 +73,7 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
73
73
expect ( r . stderr ) . not_to match ( /Error/i )
74
74
end
75
75
76
- puts " validate that the database user '#{ @db_user } ' is successfully created with default schema 'guest':"
76
+ # validate that the database user '#{@db_user}' is successfully created with default schema 'guest':
77
77
query = "USE #{ DB_NAME } ;
78
78
SELECT name AS Database_User_Name, default_schema_name
79
79
FROM SYS.DATABASE_PRINCIPALS
@@ -105,7 +105,7 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
105
105
expect ( r . stderr ) . not_to match ( /Error/i )
106
106
end
107
107
108
- puts " validate that the database user '#{ @db_user } ' is successfully created:"
108
+ # validate that the database user '#{@db_user}' is successfully created:
109
109
query = "USE #{ DB_NAME } ;
110
110
SELECT name AS Database_User_Name
111
111
FROM SYS.DATABASE_PRINCIPALS
@@ -136,7 +136,7 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
136
136
expect ( r . stderr ) . not_to match ( /Error/i )
137
137
end
138
138
139
- puts " validate that the database user '#{ @db_user } ' is mapped with sql login '#{ @new_sql_login } ':"
139
+ # validate that the database user '#{@db_user}' is mapped with sql login '#{@new_sql_login}':
140
140
query = "USE #{ DB_NAME } ;
141
141
SELECT d.name AS Database_User, l.name as Associated_sql_login
142
142
FROM SYS.DATABASE_PRINCIPALS d, MASTER.SYS.SQL_LOGINS l
@@ -194,7 +194,7 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
194
194
expect ( r . stderr ) . not_to match ( /Error/i )
195
195
end
196
196
197
- puts " validate that the database user '#{ @db_user } ' is successfully created:"
197
+ # validate that the database user '#{@db_user}' is successfully created:
198
198
query = "USE #{ DB_NAME } ; SELECT * FROM SYS.DATABASE_PRINCIPALS WHERE name = '#{ @db_user } ';"
199
199
run_sql_query ( host , { :query => query , :server => hostname , :expected_row_count => 1 } )
200
200
@@ -211,7 +211,7 @@ def ensure_sqlserver_database(host, ensure_val = 'present')
211
211
apply_manifest_on ( host , pp ) do |r |
212
212
expect ( r . stderr ) . not_to match ( /Error/i )
213
213
end
214
- puts " validate that the database user '#{ @db_user } ' should be deleted:"
214
+ # validate that the database user '#{@db_user}' should be deleted:
215
215
query = "USE #{ DB_NAME } ; SELECT * FROM SYS.DATABASE_PRINCIPALS WHERE name = '#{ @db_user } ';"
216
216
run_sql_query ( host , { :query => query , :server => hostname , :expected_row_count => 0 } )
217
217
end
0 commit comments