Skip to content

Commit ae59bfb

Browse files
committed
Fix config generation
1 parent 38789d9 commit ae59bfb

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

smoketests/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def log_records(self, n):
237237
return list(map(json.loads, logs.splitlines()))
238238

239239
def publish_module(self, domain=None, *, clear=True, capture_stderr=True, num_replicas=None, break_clients=False):
240-
print("publishing module", self.publish_module)
241240
publish_output = self.spacetime(
242241
"publish",
243242
*[domain] if domain is not None else [],
@@ -256,6 +255,8 @@ def publish_module(self, domain=None, *, clear=True, capture_stderr=True, num_re
256255

257256
@classmethod
258257
def reset_config(cls):
258+
if not STDB_CONFIG:
259+
raise Exception("config toml has not been initialized yet")
259260
cls.config_path.write_text(STDB_CONFIG)
260261

261262
def fingerprint(self):

smoketests/__main__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import logging
1414
import itertools
1515
import tempfile
16+
from pathlib import Path
17+
import shutil
1618

1719
def check_docker():
1820
docker_ps = smoketests.run_cmd("docker", "ps", "--format=json")
@@ -94,13 +96,10 @@ def main():
9496
try:
9597
os.symlink(update_bin_name, SPACETIME_BIN)
9698
except OSError:
97-
import shutil
9899
shutil.copyfile(SPACETIME_BIN.with_name(update_bin_name), SPACETIME_BIN)
99100

100101
os.environ["SPACETIME_SKIP_CLIPPY"] = "1"
101102

102-
build_template_target()
103-
104103
if args.docker:
105104
# have docker logs print concurrently with the test output
106105
if args.compose_file:
@@ -113,9 +112,9 @@ def main():
113112
subprocess.Popen(["docker", "logs", "-f", docker_container])
114113
smoketests.HAVE_DOCKER = True
115114

116-
with tempfile.NamedTemporaryFile(mode="w+b", suffix=".toml", buffering=0) as config_file:
117-
config_file.write(BASE_STDB_CONFIG_PATH.read_bytes())
118-
config_file.flush()
115+
with tempfile.NamedTemporaryFile(mode="w+b", suffix=".toml", buffering=0, delete_on_close=False) as config_file:
116+
with BASE_STDB_CONFIG_PATH.open("rb") as src, config_file.file as dst:
117+
shutil.copyfileobj(src, dst)
119118

120119
if args.remote_server is not None:
121120
smoketests.spacetime("--config-path", config_file.name, "server", "edit", "localhost", "--url", args.remote_server, "--yes")
@@ -128,8 +127,9 @@ def main():
128127
else:
129128
smoketests.new_identity(config_file.name)
130129

131-
config_file.seek(0)
132-
smoketests.STDB_CONFIG = config_file.read().decode()
130+
smoketests.STDB_CONFIG = Path(config_file.name).read_text()
131+
132+
build_template_target()
133133

134134
if not args.skip_dotnet:
135135
smoketests.HAVE_DOTNET = check_dotnet()

0 commit comments

Comments
 (0)