Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
9d616c9
Added Config for tests
SergeyKleyman Nov 12, 2024
ad68129
Added static check and GitHub workflow for it
SergeyKleyman Nov 25, 2024
154f62b
Marked test_php_static_check.sh as executable
SergeyKleyman Nov 25, 2024
0919701
Give human readable names to stages in test-php-static-check.yml
SergeyKleyman Nov 25, 2024
3168b14
Revert back to `return new CompletedFuture(null)` in `ElasticHttpTran…
SergeyKleyman Nov 26, 2024
67e6fc3
Merge branch 'main' into PHPStan_check
SergeyKleyman Nov 26, 2024
84ba309
Fixed issues found by static analysis in the changes from main
SergeyKleyman Nov 26, 2024
7f74ad6
Added ability to run multiple PHP version to test_php_static_check.sh
SergeyKleyman Nov 26, 2024
d0433c8
Fixed PHP versions format in test-php-static-check.yml matrix
SergeyKleyman Nov 26, 2024
4aae79a
Switched to generated list of the supported PHP versions
SergeyKleyman Nov 26, 2024
7829371
Make new workflow names more aligned with the existing
SergeyKleyman Nov 26, 2024
9355c4d
echo -n instead of echo in generate-php-versions.yml
SergeyKleyman Nov 26, 2024
b849f39
Fixed issues with list generation
SergeyKleyman Nov 26, 2024
d1f0dde
Refactored to have only one workflows triggered on PR
SergeyKleyman Nov 26, 2024
9a46f2b
Merge branch 'PHPStan_check' into Component_tests_infra
SergeyKleyman Nov 26, 2024
598813b
Merge branch 'main' into Component_tests_infra
SergeyKleyman Nov 27, 2024
20e1011
Fixed main merge
SergeyKleyman Nov 27, 2024
d1b3cae
Merge branch 'main' into Component_tests_infra
SergeyKleyman Nov 28, 2024
49bf8ee
Merge branch 'main' into Component_tests_infra
SergeyKleyman Jan 8, 2025
9e1c955
Merge branch 'main' into Component_tests_infra
SergeyKleyman Jan 25, 2025
a4f0b74
Implemented infrastructure for Component tests
SergeyKleyman Jan 31, 2025
b703e32
Added SpanAttributesExpectations
SergeyKleyman Jan 31, 2025
6f885db
Added ExceptionUtil::runCatchLogRethrow
SergeyKleyman Jan 31, 2025
a71c786
Removed HTTP related attributes from transaction span for CLI script
SergeyKleyman Jan 31, 2025
a356a76
Merge branch 'Remove_attrs_for_CLI_TX_span' into Component_tests_infra
SergeyKleyman Jan 31, 2025
10d543b
Adapted TransactionSpanTest to changes in "Removed HTTP related ...
SergeyKleyman Jan 31, 2025
67e0153
Fixed issues found by static analysis
SergeyKleyman Feb 1, 2025
06e6188
Removed PHPUnit assert wrappers
SergeyKleyman Feb 1, 2025
d72264f
Implemented smoke component test for curl auto-instrumentation
SergeyKleyman Feb 12, 2025
202b782
Merge branch 'main' into Component_tests_infra
SergeyKleyman Feb 12, 2025
8a15681
Fixed merge issues
SergeyKleyman Feb 12, 2025
490f1b1
Added license header
SergeyKleyman Feb 12, 2025
031eb84
Fixed inferred spans
intuibase Feb 12, 2025
397acf8
Fixed line endings
SergeyKleyman Feb 12, 2025
a5d34ca
Merge branch 'fixed_ispans' into Component_tests_infra
SergeyKleyman Feb 12, 2025
f7c22a6
Added stubs for elastic_otel_hook and elastic_otel_is_enabled
SergeyKleyman Feb 12, 2025
13cbbf5
Merge branch 'main' into Component_tests_infra
SergeyKleyman Feb 12, 2025
3017ff7
Added running PHP part unit tests to CI build
SergeyKleyman Feb 12, 2025
f793985
Added execute permissions to php_static_check_and_unit_tests.sh
SergeyKleyman Feb 12, 2025
b3cfe0b
Fixed workflow step name
SergeyKleyman Feb 12, 2025
aeaa100
Fixed DebugContextTest::testAddedTextFormat unit test on Linux
SergeyKleyman Feb 12, 2025
5a76d88
Fixed DebugContextTest::testAddedTextFormat unit test on Linux
SergeyKleyman Feb 12, 2025
6c4f3ed
Fixed DebugContextTest::testTrimVendorFrames on PHP 8.4
SergeyKleyman Feb 12, 2025
7e5ce35
Merge branch 'Component_tests_infra' into CI_for_Component_tests
SergeyKleyman Feb 12, 2025
b4b8e79
Aligned workflow names
SergeyKleyman Feb 13, 2025
16767eb
Improved tests progress display
SergeyKleyman Feb 13, 2025
623e3d3
Added execute permissions to test_php_static_and_unit.sh
SergeyKleyman Feb 13, 2025
b34c37f
Added generate_component_tests_matrix.sh and test for it
SergeyKleyman Feb 14, 2025
7f50224
Merge branch 'main' into CI_for_Component_tests
SergeyKleyman Feb 14, 2025
43c78b4
Fixed merge
SergeyKleyman Feb 14, 2025
63a8c1c
Fixed license header
SergeyKleyman Feb 14, 2025
cf599f0
Fixed copy & paste error in test-packages-component-tests.yml
SergeyKleyman Feb 14, 2025
0489775
Remove split by ',' in generate-component-tests-matrix.yml
SergeyKleyman Feb 14, 2025
102e524
Fixed hardcoded 8.4 as the highest supported PHP version in tools/bui…
SergeyKleyman Feb 14, 2025
e4261bd
Fixed string generated by generate-component-tests-matrix.yml
SergeyKleyman Feb 14, 2025
f0aa207
Upload component tests logs
SergeyKleyman Feb 14, 2025
072a2c8
Make component tests failure fail the whole build
SergeyKleyman Feb 14, 2025
2153d86
Investigate why packages are not downloaded
SergeyKleyman Feb 14, 2025
b4ab367
Try wildcard to download all packages
SergeyKleyman Feb 14, 2025
abf3951
Move all downloaded packages from sub-directories
SergeyKleyman Feb 14, 2025
dbbd736
Added matrix row unpack and test for it
SergeyKleyman Feb 14, 2025
de41700
Merge branch 'main' into CI_for_Component_tests
SergeyKleyman Feb 14, 2025
6c9bd9c
Move component tests related scripts to a separate directory
SergeyKleyman Feb 15, 2025
a1a011f
Give shorter names to GitHub workflows jobs
SergeyKleyman Feb 15, 2025
5d3c926
Shorten GitHub workflow job name
SergeyKleyman Feb 15, 2025
57be17e
Implemented component tests workflow
SergeyKleyman Feb 15, 2025
49b34f4
Fixed incorrect command line option names
SergeyKleyman Feb 15, 2025
0bebe73
Fixed select_elastic_otel_package_file
SergeyKleyman Feb 15, 2025
e4edb82
Added sections to printout
SergeyKleyman Feb 15, 2025
e54fa42
Fixed component tests Dockerfile_apk
SergeyKleyman Feb 15, 2025
262a783
Fixed component tests Dockerfile_rpm
SergeyKleyman Feb 15, 2025
5b3dc13
Print last test case log on failure
SergeyKleyman Feb 15, 2025
6f46c02
Fixed print_last_test_case
SergeyKleyman Feb 15, 2025
e475170
Fixed print_last_test_case
SergeyKleyman Feb 15, 2025
77304f3
Fixed on_script_exit
SergeyKleyman Feb 15, 2025
806fe96
Added extract of the log for the last test case and for the 100 lines
SergeyKleyman Feb 16, 2025
29799ab
Turn off bash tracing for component scripts by default
SergeyKleyman Feb 16, 2025
f807617
List content of /elastic_otel_php_tests/logs/
SergeyKleyman Feb 16, 2025
21e5d64
Rearranged GitHub workflow group markers to avoid nesting
SergeyKleyman Feb 16, 2025
e861baf
Change ownership of files copied inside docker container to allow doc…
SergeyKleyman Feb 16, 2025
0c6bc50
Fixed passing user ID and user group ID
SergeyKleyman Feb 16, 2025
9f09b04
Enabled bash tracing to debug failure
SergeyKleyman Feb 16, 2025
adcee7e
Temporary disabled testRunAndEscalateLogLevelOnFailure
SergeyKleyman Feb 16, 2025
3e4ba95
Fixed workflow names
SergeyKleyman Feb 16, 2025
f97be30
Set the same permissions for copied syslog as for created files
SergeyKleyman Feb 16, 2025
13dcdf6
Set the same permissions for copied syslog as for created files
SergeyKleyman Feb 16, 2025
de7892d
Fixed calculation for number of lines to tail for last test case part…
SergeyKleyman Feb 16, 2025
78b6e20
Fixed log ending extraction when there are no test case start lines l…
SergeyKleyman Feb 16, 2025
362df53
Re-enabled disabled testRunAndEscalateLogLevelOnFailure
SergeyKleyman Feb 16, 2025
3cab920
Redirect redundant output to /dev/null
SergeyKleyman Feb 16, 2025
2cced51
Merge branch 'CI_for_Component_tests' into Fix_flaky_component_tests
SergeyKleyman Feb 16, 2025
849cd59
Added clarifying comment
SergeyKleyman Feb 16, 2025
c4980fa
Merge branch 'main' into Fix_flaky_component_tests
SergeyKleyman Feb 16, 2025
377a35c
Re-enabled disabled testRunAndEscalateLogLevelOnFailure
SergeyKleyman Feb 16, 2025
5f2695d
Fixed "tools/build/build_native.sh" implementation "--conan_user_home"
SergeyKleyman Feb 17, 2025
2d36885
Merge branch 'Fixed_conan_cache_config' into Fix_flaky_component_tests
SergeyKleyman Feb 17, 2025
16be34b
Updated documentation regarding Conan's cache
SergeyKleyman Feb 18, 2025
36da0b5
Merge branch 'Fixed_conan_cache_config' into Fix_flaky_component_tests
SergeyKleyman Feb 18, 2025
4bbccc8
Minor fixes
SergeyKleyman Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ cd elastic-otel-php
```

This script will configure the project and build the libraries for the linux-x86-64 architecture. Adding the interactive argument allows you to interrupt the build using the `Ctrl + C` combination, and with the ncpu option, you can build in parallel using the specified number of processor threads.
If you are not adding new files to the project and just want to rebuild your changes, you can provide the `--skip_configure` argument - this will save time on reconfiguring the project. You can also save a lot of time by creating a local cache for Conan packages; the files will then be stored outside the container and reused repeatedly. To do this, provide a path to the `--conan_user_home` argument, e.g., `~/.conan`. The scipt will automatically execute native unit tests just after the build.

If you are not adding new files to the project and just want to rebuild your changes,
you can provide the `--skip_configure` argument - this will save time on reconfiguring the project.
You can also save a lot of time by creating a local cache for Conan packages;
the files will then be stored outside the container and reused repeatedly.
To do this, provide a path to the `--conan_cache_path` argument, e.g., `~/.conan_cache`.
The script will automatically execute native unit tests just after the build.
If you would like to skip native unit tests you can use `--skip_unit_tests` command line option.

Currently, we support the following architectures:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ private static function unsetLogLevelRelatedEnvVars(): array
*/
public function testRunAndEscalateLogLevelOnFailure(MixedMap $testArgs): void
{
// TODO: Re-enable ComponentTestsUtilComponentTest::testRunAndEscalateLogLevelOnFailure
// Temporarily disable this test since it's flaky
if (self::dummyAssert()) {
return;
}

$logLevelRelatedEnvVarsToRestore = self::unsetLogLevelRelatedEnvVars();
$prodCodeSyslogLevelEnvVarName = OptionForProdName::log_level_syslog->toEnvVarName();
$initialLogLevelForProdCode = $testArgs->getLogLevel(self::LOG_LEVEL_FOR_PROD_CODE_KEY);
Expand Down
35 changes: 18 additions & 17 deletions tools/build/build_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ set -x
SKIP_CONFIGURE=false

show_help() {
echo "Usage: $0 --build_architecture <architecture> [--ncpu <num_cpus>] [--conan_user_home <cache_path>] [--skip_configure] [--skip_unit_tests]"
echo "Usage: $0 --build_architecture <architecture> [--ncpu <num_cpus>] [--conan_cache_path <conan_cache_path>] [--skip_configure] [--skip_unit_tests]"
echo
echo "Arguments:"
echo " --build_architecture Required. Build architecture (e.g., 'linux-x86-64')."
echo " --ncpu Optional. Number of CPUs to use for building. Default is one less than the installed CPUs."
echo " --conan_user_home Optional. Path to local user cache for Conan."
echo " --skip_configure Optional. Skip the configuration step."
echo " --interactive Optional. Run container in interactive mode."
echo " --skip_unit_tests Optional. Skip unit tests. Default is to run unit tests."
echo " --build_architecture Required. Build architecture (e.g., 'linux-x86-64')."
echo " --ncpu Optional. Number of CPUs to use for building. Default is one less than the installed CPUs."
echo " --conan_cache_path Optional. Path to local cache for Conan."
echo " --skip_configure Optional. Skip the configuration step."
echo " --interactive Optional. Run container in interactive mode."
echo " --skip_unit_tests Optional. Skip unit tests. Default is to run unit tests."
echo
echo "Example:"
echo " $0 --build_architecture linux-x86-64 --ncpu 4 --conan_user_home ~/ --skip_configure"
echo " $0 --build_architecture linux-x86-64 --ncpu 4 --conan_cache_path ~/.conan_cache --skip_configure"
}

parse_args() {
Expand All @@ -30,8 +30,8 @@ parse_args() {
NCPU=" -j$2 "
shift
;;
--conan_user_home)
REPLACE_CONAN_USER_HOME="$2"
--conan_cache_path)
CONAN_CACHE_PATH="$2"
shift
;;
--skip_configure)
Expand Down Expand Up @@ -65,12 +65,13 @@ if [[ -z "$BUILD_ARCHITECTURE" ]]; then
exit 1
fi

# Building mount point and environment if $REPLACE_CONAN_USER_HOME not empty
if [[ -n "$REPLACE_CONAN_USER_HOME" ]]; then
echo "CONAN_USER_HOME: ${REPLACE_CONAN_USER_HOME}"
# Building mount point and environment if ${CONAN_CACHE_PATH} not empty
if [[ -n "${CONAN_CACHE_PATH}" ]]; then
echo "CONAN_CACHE_PATH: ${CONAN_CACHE_PATH}"
# due safety not mounting user home folder but only .conan
mkdir -p ${REPLACE_CONAN_USER_HOME}/.conan
CONAN_USER_HOME_MP="-e CONAN_USER_HOME="${REPLACE_CONAN_USER_HOME}" -v "${REPLACE_CONAN_USER_HOME}/.conan:${REPLACE_CONAN_USER_HOME}/.conan""
mkdir -p "${CONAN_CACHE_PATH}"
# https://docs.conan.io/2/reference/environment.html#conan-home
CONAN_HOME_MP=(-e "CONAN_HOME=/conan_home" -v "${CONAN_CACHE_PATH}:/conan_home")
fi

echo "BUILD_ARCHITECTURE: $BUILD_ARCHITECTURE"
Expand Down Expand Up @@ -98,9 +99,9 @@ fi
ls -al "${PWD}"

docker run --rm -t ${INTERACTIVE} ${USERID} -v ${PWD}:/source \
${CONAN_USER_HOME_MP} \
"${CONAN_HOME_MP[@]}" \
-w /source/prod/native \
-e GITHUB_SHA=${GITHUB_SHA} \
elasticobservability/apm-agent-php-dev:native-build-gcc-14.2.0-${BUILD_ARCHITECTURE}-0.0.1 \
sh -c "id && echo CONAN_USER_HOME=\$CONAN_USER_HOME && ${CONFIGURE} cmake --build --preset ${BUILD_ARCHITECTURE}-release ${NCPU} && ${UNIT_TESTS}"
sh -c "id && echo CONAN_HOME: \$CONAN_HOME && ${CONFIGURE} cmake --build --preset ${BUILD_ARCHITECTURE}-release ${NCPU} && ${UNIT_TESTS}"

12 changes: 7 additions & 5 deletions tools/build/build_php_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ parse_args() {
while [[ "$#" -gt 0 ]]; do
case $1 in
--php_versions)
# SC2206: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
# shellcheck disable=SC2206
PHP_VERSIONS=($2)
shift
;;
Expand Down Expand Up @@ -47,7 +49,7 @@ parse_args() {
parse_args "$@"

# Validate required arguments
if [[ -z "$PHP_VERSIONS" ]]; then
if [[ -z "${PHP_VERSIONS[*]}" ]]; then
echo "Error: Missing required arguments."
show_help
exit 1
Expand All @@ -70,11 +72,11 @@ do
fi

docker run --rm \
-v ${PWD}:/sources \
-v ${PWD}/prod/php/vendor_${PHP_VERSION}:/sources/vendor \
-e GITHUB_SHA=${GITHUB_SHA} \
-v "${PWD}:/sources" \
-v "${PWD}/prod/php/vendor_${PHP_VERSION}:/sources/vendor" \
-e "GITHUB_SHA=${GITHUB_SHA}" \
-w /sources \
php:${PHP_VERSION:0:1}.${PHP_VERSION:1:1}-cli sh -c "\
"php:${PHP_VERSION:0:1}.${PHP_VERSION:1:1}-cli" sh -c "\
apt-get update && apt-get install -y unzip git \
&& git config --global --add safe.directory /sources \
&& curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin \
Expand Down
2 changes: 1 addition & 1 deletion tools/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function convert_no_dot_to_dot_separated_version() {
echo "${no_dot_version:0:1}.${no_dot_version:1:1}"
}

function convert_dot_separated_to_no_dot_version() {
function convert_dot_separated_to_no_dot_version() {
local dot_separated_version=${1:?}
echo "${dot_separated_version/\./}"
}
Expand Down
1 change: 1 addition & 0 deletions tools/test/component/docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ function main() {
current_github_workflow_log_group_name="${current_github_workflow_log_group_name}, filter: ${ELASTIC_OTEL_PHP_TESTS_FILTER}"
fi
start_github_workflow_log_group "${current_github_workflow_log_group_name}"
# We close this GitHub workflow log group in on_script_exit()

/repo_root/tools/test/component/test_installed_package_one_matrix_row.sh
}
Expand Down
4 changes: 2 additions & 2 deletions tools/test/component/unpack_matrix_row.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -e -o pipefail

function is_value_in_array () {
# The first argument is the element that should be in array
local value_to_check="$1"
local value_to_check="${1:?}"
# The rest of the arguments is the array
local -a array=( "${@:2}" )
local -a array=("${@:2}")

for current_value in "${array[@]}"; do
if [ "${value_to_check}" == "${current_value}" ] ; then
Expand Down
Loading