recipe-maintainer: public snapshot (secrets + deployment plans removed, single commit)
Sanitized single-commit public mirror of recipe-maintainer. - Removed test-ssh/.testenv (live creds); added test-ssh/.testenv.example placeholders. - Removed plans/ and planned-updates/ (deployment-planning docs) so no client/ deployment domains appear in the public repo. - All other secret stores were already gitignored. - docs.coopcloud.tech retained as a submodule (public upstream).
This commit is contained in:
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Bluesky PDS goat account test — create, list, delete accounts via goat CLI."""
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
|
||||
from utils.tests.helpers import run, resolve_domain
|
||||
|
||||
|
||||
def run_in_container(domain, cmd):
|
||||
"""Run a command inside the app container via abra."""
|
||||
result = run(
|
||||
f'''script -qefc "abra app run {domain} app --no-tty -- sh -c '{cmd}' 2>&1" /dev/null''',
|
||||
check=False, timeout=120,
|
||||
)
|
||||
return result.stdout
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--domain', default=os.environ.get('TEST_DOMAIN'))
|
||||
args = parser.parse_args()
|
||||
domain = args.domain or resolve_domain('bluesky-pds')
|
||||
|
||||
test_handle = f"smoketest.{domain}"
|
||||
test_email = f"smoketest@{domain}"
|
||||
test_password = "testpass-goat-account-check"
|
||||
pds_host = "http://localhost:3000"
|
||||
admin_pw_flag = "--admin-password \\$(cat /run/secrets/pds_admin_password)"
|
||||
pds_flag = f"--pds-host {pds_host}"
|
||||
|
||||
# Step 1: PDS describe
|
||||
print("Step 1: Checking PDS describe ...")
|
||||
describe_output = run_in_container(domain, f"goat pds describe {pds_host} 2>&1")
|
||||
if f"did:web:{domain}" in describe_output:
|
||||
print(f"PASS: PDS describe returned expected DID (did:web:{domain})")
|
||||
else:
|
||||
print("FAIL: PDS describe did not contain expected DID")
|
||||
print(f"Output: {describe_output}")
|
||||
sys.exit(1)
|
||||
|
||||
# Step 2: Cleanup previous test account if it exists
|
||||
print("Step 2: Cleaning up previous test account if present ...")
|
||||
account_list = run_in_container(domain, f"goat pds admin account list {admin_pw_flag} {pds_flag} 2>&1")
|
||||
for did in re.findall(r'did:plc:\w+', account_list):
|
||||
info = run_in_container(domain, f"goat pds admin account info {did} {admin_pw_flag} {pds_flag} 2>&1")
|
||||
if f'"handle": "{test_handle}"' in info:
|
||||
print(f" Found existing test account ({did}), deleting ...")
|
||||
run_in_container(domain, f"goat pds admin account delete {did} {admin_pw_flag} {pds_flag} 2>&1")
|
||||
print(" Deleted.")
|
||||
|
||||
# Step 3: Create a test account
|
||||
print(f"Step 3: Creating test account ({test_handle}) ...")
|
||||
create_output = run_in_container(
|
||||
domain,
|
||||
f"goat pds admin account create {admin_pw_flag} {pds_flag} --handle {test_handle} --email {test_email} --password {test_password} 2>&1",
|
||||
)
|
||||
test_did_match = re.search(r'did:plc:\w+', create_output)
|
||||
if not test_did_match:
|
||||
print("FAIL: Could not create test account")
|
||||
print(f"Output: {create_output}")
|
||||
sys.exit(1)
|
||||
test_did = test_did_match.group()
|
||||
print(f" Account created: {create_output.strip()}")
|
||||
print(f" DID: {test_did}")
|
||||
|
||||
# Step 4: List accounts and verify the test DID is present
|
||||
print("Step 4: Verifying test account appears in account list ...")
|
||||
account_list = run_in_container(domain, f"goat pds admin account list {admin_pw_flag} {pds_flag} 2>&1")
|
||||
if test_did in account_list:
|
||||
print("PASS: Test account found in account list")
|
||||
else:
|
||||
print("FAIL: Test account not found in account list")
|
||||
sys.exit(1)
|
||||
|
||||
# Step 5: Delete the test account
|
||||
print("Step 5: Deleting test account ...")
|
||||
delete_output = run_in_container(domain, f"goat pds admin account delete {test_did} {admin_pw_flag} {pds_flag} 2>&1")
|
||||
print(f" Deleted: {delete_output.strip()}")
|
||||
|
||||
# Step 6: Verify deletion
|
||||
print("Step 6: Verifying test account is gone ...")
|
||||
account_list = run_in_container(domain, f"goat pds admin account list {admin_pw_flag} {pds_flag} 2>&1")
|
||||
if test_did in account_list:
|
||||
print("FAIL: Test account still present after deletion")
|
||||
sys.exit(1)
|
||||
print("PASS: Test account successfully deleted")
|
||||
|
||||
print("PASS: All goat account tests passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user