@@ -250,6 +250,7 @@ jobs:
250250 type :
251251 - sanitizer
252252 - dont_validate_keys
253+ - lowest_supported_server_version
253254 fail-fast : false
254255 runs-on : ubuntu-22.04
255256 needs : build
@@ -271,7 +272,7 @@ jobs:
271272 - if : ${{ matrix.type == 'sanitizer' }}
272273 run : echo WHEEL_GH_ARTIFACT_NAME=wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}-sanitizer >> $GITHUB_ENV
273274
274- - if : ${{ matrix.type == 'dont_validate_keys ' }}
275+ - if : ${{ matrix.type != 'sanitizer ' }}
275276 run : echo WHEEL_GH_ARTIFACT_NAME=wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }} >> $GITHUB_ENV
276277
277278 - uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
@@ -294,7 +295,7 @@ jobs:
294295 - uses : ./.github/actions/run-ee-server
295296 with :
296297 registry-name : ${{ env.REGISTRY_NAME }}
297- server-tag : ${{ env.SERVER_TAG }}
298+ server-tag : ${{ matrix.type == 'lowest_supported_server_version' && vars.LOWEST_SUPPORTED_SERVER_VERSION || env.SERVER_TAG }}
298299 registry-username : ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_USERNAME || secrets.QE_DOCKER_REGISTRY_USERNAME }}
299300 registry-password : ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_PW || secrets.QE_DOCKER_REGISTRY_PASSWORD }}
300301
@@ -447,15 +448,16 @@ jobs:
447448 - run : python3 test_${{ matrix.suffix }}.py
448449 working-directory : test/standalone
449450
450- test-misc :
451+ # This is an e2e test to check that the user agent was sent correctly to the server
452+ test-user-agent :
451453 needs : build
452454 strategy :
453455 fail-fast : false
454456 matrix :
455- test-case :
456- - " lowest_supported_server_version "
457- - " user_agent_with_ce "
458- - " user_agent_with_ee "
457+ test-script-args :
458+ - " false "
459+ - " true "
460+ - " true my_app_id "
459461 runs-on : ubuntu-22.04
460462 steps :
461463 - name : Harden the runner (Audit all outbound calls)
@@ -479,18 +481,8 @@ jobs:
479481 username : ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_USERNAME || secrets.QE_DOCKER_REGISTRY_USERNAME }}
480482 password : ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_PW || secrets.QE_DOCKER_REGISTRY_PASSWORD }}
481483
482- - name : Run Aerospike server
483- if : ${{ matrix.test-case != 'user_agent_with_ee' }}
484- run : docker run -d --name aerospike -p 3000:3000 -e DEFAULT_TTL=2592000 ${{ env.REGISTRY_NAME }}/aerospike/aerospike-server:${{ env.SERVER_TAG }}
485-
486- - uses : ./.github/actions/wait-for-ce-server-to-start
487- if : ${{ matrix.test-case != 'user_agent_with_ee' }}
488- with :
489- container-name : aerospike
490-
491- - id : run-ee-server
492- uses : ./.github/actions/run-ee-server
493- if : ${{ matrix.test-case == 'user_agent_with_ee' }}
484+ - uses : ./.github/actions/run-ee-server
485+ if : ${{ startsWith(matrix.test-script-args, 'true') }}
494486 with :
495487 registry-name : ${{ env.REGISTRY_NAME }}
496488 server-tag : ${{ env.SERVER_TAG }}
@@ -499,77 +491,18 @@ jobs:
499491 # The user agent can also send the client's username if app-id is not set by the client
500492 env-vars : ' SECURITY=1'
501493
502- - name : Install test dependencies
503- if : ${{ matrix.test-case == 'lowest_supported_server_version' }}
504- run : pip install -r test/requirements.txt
505-
506- - name : Create config.conf
507- if : ${{ matrix.test-case == 'lowest_supported_server_version' }}
508- run : cp config.conf.template config.conf
509- working-directory : test
494+ - if : ${{ startsWith(matrix.test-script-args, 'false') }}
495+ run : docker run -d -p 3000:3000 --name aerospike -e DEFAULT_TTL=2592000 ${{ env.REGISTRY_NAME }}/aerospike/aerospike-server:${{ env.SERVER_TAG }}
510496
511- - name : Run tests
512- if : ${{ matrix.test-case == 'lowest_supported_server_version' }}
513- run : python -m pytest ./new_tests
514- working-directory : test
497+ - if : ${{ startsWith(matrix.test-script-args, 'false') }}
498+ uses : ./.github/actions/wait-for-ce-server-to-start
499+ with :
500+ container-name : aerospike
515501
516- - if : ${{ startsWith(matrix.test-case, 'user_agent') }}
517502 # Even for server versions < 8.1 that don't support user agent, this client version should still work on older servers
518- name : Run client in background
519- run : |
520- set -x
521- cat <<-EOF >> run-client-in-bg.py
522- import aerospike
523- import time
524- import sys
525- config = {
526- "hosts": [
527- ("127.0.0.1", 3000)
528- ]
529- }
530- if "${{ endsWith(matrix.test-case, 'with_ee') }}" == "true":
531- config["user"] = "superuser"
532- config["password"] = "superuser"
533- client = aerospike.client(config)
534- while True:
535- time.sleep(1)
536- EOF
537- # This shell will be closed once this step completes
538- nohup python3 run-client-in-bg.py &
539- # TODO: We want to check if the python script raises a syntax error or not. (should fail immediately)
540- # When background processes fail, this step won't fail.
541-
542- - if : ${{ startsWith(matrix.test-case, 'user_agent') }}
543- name : Confirm that the user agent shows the correct client language and version (only for server 8.1)
544- run : |
545- if [[ "${{ endsWith(matrix.test-case, 'with_ee') }}" == "true" ]]; then
546- CREDENTIALS="-U superuser -P superuser"
547- fi
548-
549- server_version=$(docker run --network host aerospike/aerospike-tools asinfo $CREDENTIALS -v "build")
550- major_num=$(echo $server_version | cut -d '.' -f 1)
551- minor_num=$(echo $server_version | cut -d '.' -f 2)
552- if [[ $major_num -lt 8 || ( $major_num -eq 8 && $minor_num -lt 1 ) ]]; then
553- exit 0
554- fi
555-
556- info_cmd_response=$(docker run --network host aerospike/aerospike-tools asinfo $CREDENTIALS -v "user-agents" | head -n 1)
557- echo "Info command response: $info_cmd_response"
558- # Response format: user-agent=<base64 encoded string>:...
559- user_agent_base64_encoded=$(echo $info_cmd_response | perl -n -E 'say $1 if m/user-agent= ([a-zA-Z0-9+\/=]+) :/x')
560- echo $user_agent_base64_encoded
561- user_agent=$(echo $user_agent_base64_encoded | base64 -d)
562- echo $user_agent
563- # TODO: combine into one regex
564- # User agent format: <format-version>,<client language>-<version>,...
565- client_language=$(echo $user_agent | perl -n -E 'say $1 if m/[0-9]+, ([a-z]+) -/x')
566- client_version=$(echo $user_agent | perl -n -E 'say $1 if m/[0-9]+,[a-z]+- ([0-9.a-zA-Z+]+),/x')
567- echo $client_language
568- echo $client_version
569-
570- test "$client_language" = "python"
571-
572- # Client version from user agent
573- expected_client_version=$(python3 -m pip show aerospike | grep -i version | cut -d " " -f 2-)
574- test "$client_version" = "$expected_client_version"
575- shell : bash
503+ - name : Run client in background
504+ run : ./test-user-agent-e2e.bash ${{ matrix.test-script-args }}
505+ working-directory : test/standalone
506+
507+ - if : ${{ !cancelled() }}
508+ run : docker logs aerospike
0 commit comments