tools: make v test detect a running redis server too, and make that info available to the individual tests through // vtest build: present_redis?

This commit is contained in:
Delyan Angelov 2025-09-22 10:56:01 +03:00
parent a5d7f36691
commit 4645db3ec4
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 7 additions and 1 deletions

View File

@ -904,6 +904,9 @@ pub const is_started_mysqld = find_started_process('mysqld') or { '' }
// is_started_postgres is true, when the test runner determines that there is a running postgres server
pub const is_started_postgres = find_started_process('postgres') or { '' }
// is_started_redis is true, when the test runner determines that there is a running redis server
pub const is_started_redis = find_started_process('redis-server') or { '' }
pub fn (mut ts TestSession) setup_build_environment() {
facts, mut defines := pref.get_build_facts_and_defines()
// add the runtime information, that the test runner has already determined by checking once:
@ -913,6 +916,9 @@ pub fn (mut ts TestSession) setup_build_environment() {
if is_started_postgres != '' {
defines << 'started_postgres'
}
if is_started_redis != '' {
defines << 'started_redis'
}
if is_node_present {
defines << 'present_node'
}

View File

@ -1,4 +1,4 @@
// vtest build: present_redis?
// vtest build: started_redis?
import db.redis
import time