Commit b0ed0bc0 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend/test: Assert file existence before rewrite

parent b50f2166
...@@ -2411,9 +2411,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2411,9 +2411,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual(httplib.NOT_FOUND, result_http.status_code) self.assertEqual(httplib.NOT_FOUND, result_http.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost')
os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost'), 'w' self.assertTrue(os.path.isfile(fname))
).write('echo "$@"') open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
...@@ -2453,9 +2453,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2453,9 +2453,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual(httplib.NOT_FOUND, result_http.status_code) self.assertEqual(httplib.NOT_FOUND, result_http.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost')
os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost'), 'w' self.assertTrue(os.path.isfile(fname))
).write('echo "$@"') open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
...@@ -2495,10 +2495,10 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s { ...@@ -2495,10 +2495,10 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqual(httplib.NOT_FOUND, result_http.status_code) self.assertEqual(httplib.NOT_FOUND, result_http.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(
os.path.join( self.software_path, 'bin', 'check-re6st-optimal-status')
self.software_path, 'bin', 'check-re6st-optimal-status'), 'w' self.assertTrue(os.path.isfile(fname))
).write('echo "$@"') open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
...@@ -3836,10 +3836,10 @@ https://www.google.com {}""", ...@@ -3836,10 +3836,10 @@ https://www.google.com {}""",
self.assertEqual(httplib.NOT_FOUND, result.status_code) self.assertEqual(httplib.NOT_FOUND, result.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(
os.path.join( self.software_path, 'bin', 'check-re6st-optimal-status')
self.software_path, 'bin', 'check-re6st-optimal-status'), 'w' self.assertTrue(os.path.isfile(fname))
).write('echo "$@"') open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
...@@ -4030,9 +4030,10 @@ https://www.google.com {}""", ...@@ -4030,9 +4030,10 @@ https://www.google.com {}""",
self.assertEqual(httplib.NOT_FOUND, result_http.status_code) self.assertEqual(httplib.NOT_FOUND, result_http.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(
os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost'), 'w' self.software_path, 'bin', 'is-icmp-packet-lost')
).write('echo "$@"') self.assertTrue(os.path.isfile(fname))
open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
...@@ -4072,9 +4073,10 @@ https://www.google.com {}""", ...@@ -4072,9 +4073,10 @@ https://www.google.com {}""",
self.assertEqual(httplib.NOT_FOUND, result_http.status_code) self.assertEqual(httplib.NOT_FOUND, result_http.status_code)
# rewrite SR/bin/is-icmp-packet-lost # rewrite SR/bin/is-icmp-packet-lost
open( fname = os.path.join(
os.path.join(self.software_path, 'bin', 'is-icmp-packet-lost'), 'w' self.software_path, 'bin', 'is-icmp-packet-lost')
).write('echo "$@"') self.assertTrue(os.path.isfile(fname))
open(fname, 'w').write('echo "$@"')
# call the monitor for this partition # call the monitor for this partition
monitor_file = glob.glob( monitor_file = glob.glob(
os.path.join( os.path.join(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment