Files
SpacetimeDB/test/tests/setname.sh
T
Phoebe Goldman a1e9984840 Multiple server configurations for CLI (#214)
Alters the CLI's configuration format to support storing multiple server configurations,
and having each server configuration store an (optional) default identity.
Many CLI commands take an additional -s argument, the server on which to operate,
which defaults to the configured default_server.
Using -s consistently requires renaming the publish skip-clippy short flag to -S.

Per discussion with @jdetter , this PR does not directly associate identities with servers.
Instead, each server configuration stores the server's "fingerprint" (i.e. PEM-formatted ECDSA public key),
and the CLI uses that public key to decode tokens to determine if they apply to a given server.
This architecture allows the CLI to behave reasonably
when multiple server configurations use the same set of tokens,
e.g. if multiple distinct URLs resolve to the same SpacetimeDB instance.
For example, one could imagine a configuration with server configurations for both http://127.0.0.1:3000
and http://localhost:3000, which should use the same set of identities.
2023-09-01 17:29:20 +00:00

24 lines
700 B
Bash

#!/bin/bash
if [ "$DESCRIBE_TEST" = 1 ] ; then
echo "Tests the functionality of the setname command."
exit
fi
set -euox pipefail
source "./test/lib.include"
run_test cargo run identity init-default
run_test cargo run publish -S -d --project-path "$PROJECT_PATH" --clear-database
ADDRESS="$(grep "reated new database" "$TEST_OUT" | awk 'NF>1{print $NF}')"
RAND_NAME="$(random_string)"
run_test cargo run dns register-tld "$RAND_NAME"
run_test cargo run dns set-name "$RAND_NAME" "$ADDRESS"
run_test cargo run dns lookup "$RAND_NAME"
[ "$(cat "$TEST_OUT" | tail -n 1)" == "$ADDRESS" ]
run_test cargo run dns reverse-lookup "$ADDRESS"
[ "$(cat "$TEST_OUT" | tail -n 1)" == "$RAND_NAME" ]