deploy/compose.todo.yaml adds Todo's server at todo.halkyon.eu, a member of Learn's register, its database halkyon_todo in the instance's PostgreSQL, its image built as Train's. redeploy.sh and backup.sh go over every app server .env switches on (train, todo). Each compose file names its server to the register in a variable of its own (INSTANCE_MEMBER_TRAIN, INSTANCE_MEMBER_TODO), which halkyon_base adds to INSTANCE_MEMBERS, each address once, as a second compose file's default would have replaced Train's. apps/todo/release.dart configures the release tool for Todo's APK and snap: a key of its own (pinned once made; until then nothing is released), the F-Droid listing (Time, NonFreeNet), and the snap from apps/todo/snap/, which the tool builds in a clone of the repository at the tag with that folder in place of snap/, as snapcraft builds one recipe a folder and the root's is Learn's. What's new for 0.1.0 in English and German, now shown. Android's backup and transfer are off, as Train's (D53): the reminders scheduled keep their tasks' titles unsealed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
93 lines
2.9 KiB
Dart
93 lines
2.9 KiB
Dart
import 'package:halkyon_base_server/base.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('The accounts mode from the environment', () {
|
|
test('without settings, the server holds its own register, with no '
|
|
'members', () {
|
|
final mode = AccountsMode.fromEnvironment(const {});
|
|
|
|
expect(mode, isA<HoldsRegister>());
|
|
expect((mode as HoldsRegister).members, isEmpty);
|
|
});
|
|
|
|
test('the register tells the members it names, separated by commas or '
|
|
'spaces', () {
|
|
final mode = AccountsMode.fromEnvironment(const {
|
|
'INSTANCE_MEMBERS': ' https://todo.example.com, http://todo:8082 ',
|
|
});
|
|
|
|
expect((mode as HoldsRegister).members, [
|
|
Uri.parse('https://todo.example.com'),
|
|
Uri.parse('http://todo:8082'),
|
|
]);
|
|
});
|
|
|
|
test("each service's compose file names itself as a member of its own "
|
|
'(`INSTANCE_MEMBER_<NAME>`), beside those of `INSTANCE_MEMBERS`, each '
|
|
'once', () {
|
|
final mode = AccountsMode.fromEnvironment(const {
|
|
'INSTANCE_MEMBER_TODO': 'http://todo-server:8082/',
|
|
'INSTANCE_MEMBERS': 'http://train-server:8082/ https://other.example',
|
|
'INSTANCE_MEMBER_TRAIN': 'http://train-server:8082/',
|
|
'INSTANCE_MEMBER_EMPTY': '',
|
|
'INSTANCE_MEMBERSHIP': 'http://not-a-member',
|
|
});
|
|
|
|
expect((mode as HoldsRegister).members, [
|
|
Uri.parse('http://train-server:8082/'),
|
|
Uri.parse('https://other.example'),
|
|
Uri.parse('http://todo-server:8082/'),
|
|
]);
|
|
});
|
|
|
|
test('a register named makes the server its member', () {
|
|
final mode = AccountsMode.fromEnvironment(const {
|
|
'ACCOUNT_REGISTER_URL': 'http://learn:8082',
|
|
'INSTANCE_MEMBERS': 'http://ignored',
|
|
});
|
|
|
|
expect(
|
|
(mode as MemberOfRegister).register,
|
|
Uri.parse('http://learn:8082'),
|
|
);
|
|
});
|
|
|
|
test('empty values count as unset, as Compose passes them on', () {
|
|
expect(
|
|
AccountsMode.fromEnvironment(const {
|
|
'ACCOUNT_REGISTER_URL': '',
|
|
'INSTANCE_MEMBERS': ' ',
|
|
}),
|
|
isA<HoldsRegister>(),
|
|
);
|
|
});
|
|
|
|
test('anything but an HTTP(S) address is refused, not guessed at', () {
|
|
expect(
|
|
() => AccountsMode.fromEnvironment(const {
|
|
'ACCOUNT_REGISTER_URL': 'learn:8082',
|
|
}),
|
|
throwsArgumentError,
|
|
);
|
|
expect(
|
|
() => AccountsMode.fromEnvironment(const {
|
|
'INSTANCE_MEMBERS': 'ftp://todo',
|
|
}),
|
|
throwsArgumentError,
|
|
);
|
|
expect(
|
|
() => AccountsMode.fromEnvironment(const {
|
|
'INSTANCE_MEMBER_TODO': 'todo-server:8082',
|
|
}),
|
|
throwsArgumentError,
|
|
);
|
|
});
|
|
});
|
|
|
|
test('the shared secret is the same only when it is', () {
|
|
expect(isInstanceSecret('s3cret', 's3cret'), isTrue);
|
|
expect(isInstanceSecret('s3cret!', 's3cret'), isFalse);
|
|
expect(isInstanceSecret('', 's3cret'), isFalse);
|
|
});
|
|
}
|