From 47bc16a73f00222bf8b639bcb1fd62c88e655820 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 14 Sep 2023 21:53:35 +0300 Subject: [PATCH] Fixed .phpt tests --- agent/native/ext/tests/config_defaults.phpt | 8 +++++--- .../config_setting_to_invalid_values_using_env_vars.phpt | 8 +++++--- .../tests/config_setting_to_invalid_values_using_ini.phpt | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/agent/native/ext/tests/config_defaults.phpt b/agent/native/ext/tests/config_defaults.phpt index d949cbaae..dbc3618c4 100644 --- a/agent/native/ext/tests/config_defaults.phpt +++ b/agent/native/ext/tests/config_defaults.phpt @@ -25,9 +25,11 @@ elasticApmAssertSame("getenv('ELASTIC_APM_ENABLED')", getenv('ELASTIC_APM_ENABLE elasticApmAssertEqual("ini_get('elastic_apm.enabled')", ini_get('elastic_apm.enabled'), false); -elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), true); - -elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), true); +if (($agentEnabledConfigDefaultEnvVar = getenv('ELASTIC_APM_PHP_TESTS_AGENT_ENABLED_CONFIG_DEFAULT')) !== false) { + $agentEnabledConfigDefault = json_decode($agentEnabledConfigDefaultEnvVar); + elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), $agentEnabledConfigDefault); + elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), $agentEnabledConfigDefault); +} ////////////////////////////////////////////// /////////////// log_file diff --git a/agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt b/agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt index 78ee5e4bb..cdc65f351 100644 --- a/agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt +++ b/agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt @@ -19,9 +19,11 @@ require __DIR__ . '/../tests_util/tests_util.php'; elasticApmAssertSame("getenv('ELASTIC_APM_ENABLED')", getenv('ELASTIC_APM_ENABLED'), 'not_valid_boolean_value'); -elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), true); - -elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), true); +if (($agentEnabledConfigDefaultEnvVar = getenv('ELASTIC_APM_PHP_TESTS_AGENT_ENABLED_CONFIG_DEFAULT')) !== false) { + $agentEnabledConfigDefault = json_decode($agentEnabledConfigDefaultEnvVar); + elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), $agentEnabledConfigDefault); + elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), $agentEnabledConfigDefault); +} ////////////////////////////////////////////// /////////////// assert_level diff --git a/agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt b/agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt index df8e03fb1..99321c964 100644 --- a/agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt +++ b/agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt @@ -19,9 +19,11 @@ require __DIR__ . '/../tests_util/tests_util.php'; elasticApmAssertEqual("ini_get('elastic_apm.enabled')", ini_get('elastic_apm.enabled'), 'not valid boolean value'); -elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), true); - -elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), true); +if (($agentEnabledConfigDefaultEnvVar = getenv('ELASTIC_APM_PHP_TESTS_AGENT_ENABLED_CONFIG_DEFAULT')) !== false) { + $agentEnabledConfigDefault = json_decode($agentEnabledConfigDefaultEnvVar); + elasticApmAssertSame("elastic_apm_is_enabled()", elastic_apm_is_enabled(), $agentEnabledConfigDefault); + elasticApmAssertSame("elastic_apm_get_config_option_by_name('enabled')", elastic_apm_get_config_option_by_name('enabled'), $agentEnabledConfigDefault); +} ////////////////////////////////////////////// /////////////// assert_level