From a638a16af00f82797f0d324a6f6be16b576b0a3c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 16 May 2026 14:50:08 +0300 Subject: [PATCH] config: add loader tests --- config/loader_test.v | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 config/loader_test.v diff --git a/config/loader_test.v b/config/loader_test.v new file mode 100644 index 0000000..d894404 --- /dev/null +++ b/config/loader_test.v @@ -0,0 +1,21 @@ +module config + +import os + +fn test_read_config_uses_database_defaults() { + path := os.join_path(os.temp_dir(), 'gitly_config_defaults_${os.getpid()}.json') + os.write_file(path, + '{"repo_storage_path":"./repos","archive_path":"./archives","avatars_path":"./avatars","hostname":"gitly.test","ci_service_url":"http://localhost:8081"}')! + defer { + os.rm(path) or {} + } + + conf := read_config(path)! + + assert conf.pg.host == 'localhost' + assert conf.pg.port == 5432 + assert conf.pg.dbname == 'gitly' + assert conf.pg.user == 'gitly' + assert conf.pg.password == 'gitly' + assert conf.sqlite.path == 'gitly.sqlite' +} -- 2.39.5