Commit 355f1a7d authored by Grigorii Demidov's avatar Grigorii Demidov

tests: libfaketime config generation

parent 98cc07d9
......@@ -299,8 +299,6 @@ class Step:
msg = self.data[0].message
msg.use_edns(edns = 1)
data_to_wire = msg.to_wire()
# self.raw_answer = ctx.resolve(data_to_wire)
# ctx.last_raw_answer = self.raw_answer
ctx.sockudp4.sendto(data_to_wire,(peeraddr,53))
ctx.sockudp4.settimeout(10)
if self.data[0].is_raw_data_entry is True:
......
......@@ -45,7 +45,6 @@ if "SOCKET_WRAPPER_DIR" in os.environ:
if TMPDIR == "" or os.path.isdir(TMPDIR) is False:
OLDTMPDIR = TMPDIR
TMPDIR = tempfile.mkdtemp(suffix='', prefix='tmp')
# os.chmod(TMPDIR,stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IWOTH|stat.S_IXOTH)
os.environ["SOCKET_WRAPPER_DIR"] = TMPDIR
if TEST_DEBUG > 0:
testserver.syn_print(None,"SOCKET_WRAPPER_DIR is invalid or empty ({}), set to default ({})".format(OLDTMPDIR, TMPDIR))
......@@ -53,13 +52,6 @@ if TEST_DEBUG > 0:
testserver.syn_print(None,"default_iface: {}, child_iface: {}, tmpdir {}".format(DEFAULT_IFACE, CHILD_IFACE, TMPDIR))
del_files(TMPDIR)
# Set up libfaketime
os.environ["FAKETIME_NO_CACHE"] = "1"
os.environ["FAKETIME_TIMESTAMP_FILE"] = '%s/.time' % TMPDIR
time_file = open(os.environ["FAKETIME_TIMESTAMP_FILE"], 'w')
time_file.write(datetime.fromtimestamp(0).strftime('%Y-%m-%d %H:%M:%S'))
time_file.close()
def get_next(file_in):
""" Return next token from the input stream. """
while True:
......@@ -185,6 +177,13 @@ def play_object(path):
finally:
file_in.close()
# Set up libfaketime
os.environ["FAKETIME_NO_CACHE"] = "1"
os.environ["FAKETIME_TIMESTAMP_FILE"] = '%s/.time' % TMPDIR
time_file = open(os.environ["FAKETIME_TIMESTAMP_FILE"], 'w')
time_file.write(datetime.fromtimestamp(0).strftime('%Y-%m-%d %H:%M:%S'))
time_file.close()
child_env = os.environ.copy()
child_env["SOCKET_WRAPPER_DEFAULT_IFACE"] = "%i" % CHILD_IFACE
child_env["SOCKET_WRAPPER_DIR"] = TMPDIR
......
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