Browse Source

tox: fix the test suite

fix pep8 syntax (H904 Wrap long lines in parentheses instead of a backslash).

fix two regressions in test_os_svc_daemon.py introduced by
    Ibd491881d79160ad1457526d51512f5fc1cf9ea5:
  - ensure os-svc-daemon won't try to write in /etc/os-logging by passing
    the “-l” extra parameter.
  - fix the test_standard_upstart test from test_os_svc_daemon.py to
     match the expected outpout.

Change-Id: I113504947d126e9d91409f97f8291d5b8fc15c42
Gonéri Le Bouder 4 years ago
parent
commit
e58007c9c4

+ 4
- 4
elements/mysql-common/os-refresh-config/post-configure.d/50-mysql-users View File

@@ -93,10 +93,10 @@ for createuser in to_create:
93 93
     else:
94 94
         cmd = "GRANT %s ON *.*" % (privilege)
95 95
 
96
-    cmd_local = "%s TO `%s`@'localhost' IDENTIFIED BY '%s'" \
97
-        % (cmd, username, password)
98
-    cmd_global = "%s TO `%s`@'%%' IDENTIFIED BY '%s'" \
99
-        % (cmd, username, password)
96
+    cmd_local = ("%s TO `%s`@'localhost' IDENTIFIED BY '%s'" %
97
+                 (cmd, username, password))
98
+    cmd_global = ("%s TO `%s`@'%%' IDENTIFIED BY '%s'" %
99
+                  (cmd, username, password))
100 100
 
101 101
     if opts.noop:
102 102
         print(cmd_local)

+ 9
- 2
elements/os-svc-install/tests/test_os_svc_daemon.py View File

@@ -24,6 +24,7 @@ class TestOsSvcDaemon(tests.base.ScriptTestBase):
24 24
         self._stub_script('dib-init-system', 'echo systemd')
25 25
         output = self._run_command(
26 26
             ['elements/os-svc-install/bin/os-svc-daemon',
27
+             '-l',
27 28
              '-p',
28 29
              '-n', 'foo',
29 30
              '-u', 'bar',
@@ -59,6 +60,7 @@ RequiredBy=foo.service
59 60
         self._stub_script('dib-init-system', 'echo upstart')
60 61
         output = self._run_command(
61 62
             ['elements/os-svc-install/bin/os-svc-daemon',
63
+             '-l',
62 64
              '-p',
63 65
              '-n', 'foo',
64 66
              '-u', 'bar',
@@ -78,8 +80,8 @@ end script
78 80
 
79 81
 respawn
80 82
 # the default post-start of 1 second sleep delays respawning enough to
81
-# not hit the default of 10 times in 5 seconds. Make it 2 times in 5s.
82
-respawn limit 2 5
83
+# not hit the default of 10 times in 5 seconds. Make it 2 times in 10s.
84
+respawn limit 2 10
83 85
 
84 86
 exec start-stop-daemon --start -c bar --exec /opt/stack/venvs/bar/bin/baz -- a
85 87
 
@@ -91,6 +93,7 @@ post-start exec sleep 1
91 93
         self._stub_script('dib-init-system', 'echo systemd')
92 94
         output = self._run_command(
93 95
             ['elements/os-svc-install/bin/os-svc-daemon',
96
+             '-l',
94 97
              '-p',
95 98
              '-n', 'foo',
96 99
              '-u', 'bar',
@@ -112,6 +115,7 @@ RequiredBy=foo.service
112 115
         self._stub_script('dib-init-system', 'echo upstart')
113 116
         output = self._run_command(
114 117
             ['elements/os-svc-install/bin/os-svc-daemon',
118
+             '-l',
115 119
              '-p',
116 120
              '-n', 'foo',
117 121
              '-u', 'bar',
@@ -134,6 +138,7 @@ end script
134 138
         self._stub_script('dib-init-system', 'echo systemd')
135 139
         output = self._run_command(
136 140
             ['elements/os-svc-install/bin/os-svc-daemon',
141
+             '-l',
137 142
              '-p',
138 143
              '-n', 'foo',
139 144
              '-u', 'foo',
@@ -146,6 +151,7 @@ end script
146 151
         self._stub_script('dib-init-system', 'echo upstart')
147 152
         output = self._run_command(
148 153
             ['elements/os-svc-install/bin/os-svc-daemon',
154
+             '-l',
149 155
              '-p',
150 156
              '-n', 'foo',
151 157
              '-u', 'foo',
@@ -182,6 +188,7 @@ end script
182 188
         self._stub_script('dib-init-system', 'echo upstart')
183 189
         output = self._run_command(
184 190
             ['elements/os-svc-install/bin/os-svc-daemon',
191
+             '-l',
185 192
              '-p',
186 193
              '-n', 'foo',
187 194
              '-u', 'foo',

Loading…
Cancel
Save