A lot closer to passing grid manager integration tests.

This commit is contained in:
Itamar Turner-Trauring 2022-07-29 09:43:37 -04:00
parent c0be036e04
commit 02cb4105b3
3 changed files with 11 additions and 6 deletions

View File

@ -194,7 +194,7 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a
"storage0", pubkey_str,
stdinBytes=gm_config,
)
assert json.loads(gm_config)['storage_servers'].keys() == ['storage0']
assert json.loads(gm_config)['storage_servers'].keys() == {'storage0'}
print("inserting certificate")
cert = yield _run_gm(
@ -221,7 +221,7 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a
config = configutil.get_config(join(diana.process.node_dir, "tahoe.cfg"))
config.add_section("grid_managers")
config.set("grid_managers", "test", ed25519.string_from_verifying_key(gm_pubkey))
config.set("grid_managers", "test", str(ed25519.string_from_verifying_key(gm_pubkey), "ascii"))
with open(join(diana.process.node_dir, "tahoe.cfg"), "w") as f:
config.write(f)
@ -235,7 +235,7 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a
yield util.run_tahoe(
reactor, request, "--node-directory", diana.process.node_dir,
"put", "-",
stdin="some content\n" * 200,
stdin=b"some content\n" * 200,
)
assert False, "Should get a failure"
except util.ProcessFailed as e:

View File

@ -225,3 +225,7 @@ def _config_path_from_option(config: str) -> Optional[FilePath]:
if config == "-":
return None
return FilePath(config)
if __name__ == '__main__':
grid_manager()

View File

@ -37,8 +37,9 @@ from os import urandom
import re
import time
import hashlib
from io import StringIO
from configparser import NoSectionError
import json
import attr
from zope.interface import (
@ -67,7 +68,7 @@ from allmydata.interfaces import (
IFoolscapStoragePlugin,
)
from allmydata.grid_manager import (
create_grid_manager_verifier,
create_grid_manager_verifier, SignedCertificate
)
from allmydata.crypto import (
ed25519,
@ -289,7 +290,7 @@ class StorageFarmBroker(service.MultiService):
handler_overrides = server.get("connections", {})
gm_verifier = create_grid_manager_verifier(
self.storage_client_config.grid_manager_keys,
server["ann"].get("grid-manager-certificates", []),
[SignedCertificate.load(StringIO(json.dumps(data))) for data in server["ann"].get("grid-manager-certificates", [])],
"pub-{}".format(str(server_id, "ascii")), # server_id is v0-<key> not pub-v0-key .. for reasons?
)