1
1
# frozen_string_literal: true
2
2
3
+ require 'singleton'
4
+
5
+ class LitmusHelper
6
+ include Singleton
7
+ include PuppetLitmus
8
+ end
9
+
3
10
def pre_run
4
- apply_manifest ( "class { 'mysql::server': root_password => 'password' }" , catch_failures : true )
11
+ LitmusHelper . instance . apply_manifest ( "class { 'mysql::server': root_password => 'password' }" , catch_failures : true )
5
12
end
6
13
7
14
def mysql_version
8
- shell_output = run_shell ( 'mysql --version' , expect_failures : true )
15
+ shell_output = LitmusHelper . instance . run_shell ( 'mysql --version' , expect_failures : true )
9
16
if shell_output . stdout . match ( %r{\d +\. \d +\. \d +} ) . nil?
10
17
pre_run
11
- shell_output = run_shell ( 'mysql --version' )
18
+ shell_output = LitmusHelper . instance . run_shell ( 'mysql --version' )
12
19
raise _ ( 'unable to get mysql version' ) if shell_output . stdout . match ( %r{\d +\. \d +\. \d +} ) . nil?
13
20
end
14
21
mysql_version = shell_output . stdout . match ( %r{\d +\. \d +\. \d +} ) [ 0 ]
@@ -19,9 +26,9 @@ def mysql_version
19
26
c . before :suite do
20
27
if os [ :family ] == 'debian' || os [ :family ] == 'ubuntu'
21
28
# needed for the puppet fact
22
- apply_manifest ( "package { 'lsb-release': ensure => installed, }" , expect_failures : false )
29
+ LitmusHelper . instance . apply_manifest ( "package { 'lsb-release': ensure => installed, }" , expect_failures : false )
23
30
end
24
31
# needed for the grant tests, not installed on el7 docker images
25
- apply_manifest ( "package { 'which': ensure => installed, }" , expect_failures : false )
32
+ LitmusHelper . instance . apply_manifest ( "package { 'which': ensure => installed, }" , expect_failures : false )
26
33
end
27
34
end
0 commit comments