Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client xxxx refactor smoke tests #641

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .github/actions/run-ee-server-and-setup-config-conf/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Run enterprise edition server and setup config.conf'
inputs:
is-client-in-another-container:
required: true
default: 'false'
description: 'Is client in a Docker container separate from the server container? If false, client is running in Docker host'
use-server-rc:
required: true
default: false
server-tag:
required: true
default: 'latest'
docker-hub-username:
required: false
docker-hub-password:
required: false

runs:
using: "composite"
steps:
- uses: ./.github/actions/run-ee-server
id: run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
docker-hub-username: ${{ inputs.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ inputs.DOCKER_HUB_BOT_PW }}

- uses: ./.github/actions/setup-config-conf
with:
using-ee-server: 'true'
ee-host-ip-address: ${{ inputs.is-client-in-another-container == 'true' && steps.run-ee-server.outputs.server-docker-ip-address || '127.0.0.1' }}
37 changes: 0 additions & 37 deletions .github/actions/run-ee-server-for-ext-container/action.yml

This file was deleted.

62 changes: 32 additions & 30 deletions .github/actions/run-ee-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,13 @@ inputs:
required: false
docker-hub-password:
required: false
outputs:
server-docker-ip-address:
value: ${{ steps.get-server-docker-ip-address.outputs.ip-address }}

runs:
using: "composite"
steps:
- name: Install crudini to manipulate config.conf
run: pip3 install crudini -c requirements.txt
working-directory: .github/workflows
shell: bash

- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
shell: bash

- name: Use enterprise edition instead of community edition in config.conf
run: |
crudini --existing=param --set config.conf enterprise-edition hosts ''
crudini --existing=param --set config.conf enterprise-edition hosts 127.0.0.1:3000
crudini --existing=param --set config.conf enterprise-edition user superuser
crudini --existing=param --set config.conf enterprise-edition password superuser
working-directory: test
shell: bash

- name: Create config folder to store configs in
run: mkdir configs
shell: bash

- name: Use release server
if: ${{ inputs.use-server-rc == 'false' }}
run: echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise" >> $GITHUB_ENV
Expand All @@ -56,13 +36,30 @@ runs:
run: docker login --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
shell: bash

- name: Get default aerospike.conf from Docker server EE container
run: |
docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE:${{ inputs.server-tag }}
sleep 5
docker cp aerospike:/etc/aerospike/aerospike.conf ./configs/aerospike.conf
docker container stop aerospike
docker container rm aerospike
- name: Run EE server from Docker image
run: docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE:${{ inputs.server-tag }}
shell: bash

- name: Wait for EE server to start
run: sleep 5
shell: bash

- name: Create config folder to store configs in
# Cannot create parent directories using docker cp
# https://docs.docker.com/reference/cli/docker/container/cp/
run: mkdir configs
shell: bash

- name: Grab default aerospike.conf from EE server
run: docker cp aerospike:/etc/aerospike/aerospike.conf ./configs/aerospike.conf
shell: bash

- name: Stop EE server
run: docker container stop aerospike
shell: bash

- name: Remove EE server
run: docker container rm aerospike
shell: bash

- name: Enable security features using aerospike.conf
Expand All @@ -79,3 +76,8 @@ runs:
# Use default admin user to create another user for testing
run: docker exec aerospike asadm --user admin --password admin --enable -e "manage acl create user superuser password superuser roles read-write-udf sys-admin user-admin data-admin"
shell: bash

- name: Output internal Docker IP address of server
id: get-server-docker-ip-address
run: echo "ip-address=$(docker inspect aerospike -f '{{ .NetworkSettings.IPAddress }}')" >> $GITHUB_OUTPUT
shell: bash
32 changes: 32 additions & 0 deletions .github/actions/setup-config-conf-for-ee/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Setup config.conf for enterprise edition server'
inputs:
host-ip-address:
required: true

runs:
using: "composite"
steps:
- name: Install crudini to manipulate config.conf
run: pip3 install crudini -c requirements.txt
working-directory: .github/workflows
shell: bash

- name: Don't use community edition in config.conf
run: crudini --existing=param --set config.conf community-edition hosts ''
working-directory: test
shell: bash

- name: Set host in config file
run: crudini --existing=param --set config.conf enterprise-edition hosts ${{ inputs.host-ip-address }}:3000
working-directory: test
shell: bash

- name: Set user in config file
run: crudini --existing=param --set config.conf enterprise-edition user superuser
working-directory: test
shell: bash

- name: Set password in config file
run: crudini --existing=param --set config.conf enterprise-edition password superuser
working-directory: test
shell: bash
23 changes: 23 additions & 0 deletions .github/actions/setup-config-conf/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Setup config.conf'
description: 'Setup config.conf from config.conf.template'
inputs:
using-ee-server:
required: false
default: false
ee-host-ip-address:
required: false
default: '127.0.0.1'

runs:
using: "composite"
steps:
- name: Install config.conf to use community edition
run: cp config.conf.template config.conf
working-directory: test
shell: bash

- name: If using EE server, modify config.conf accordingly
if: ${{ inputs.using-ee-server == 'true' }}
uses: ./.github/actions/setup-config-conf-for-ee
with:
host-ip-address: ${{ inputs.ee-host-ip-address }}
8 changes: 2 additions & 6 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,7 @@ jobs:
run: python${{ matrix.python-version[1] }} -m pip install --break-system-packages --force-reinstall delocate -c ./requirements.txt
working-directory: .github/workflows

- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/setup-config-conf

- run: delocate-wheel --require-archs "arm64" -w wheelhouse/ -v dist/*.whl
- run: python${{ matrix.python-version[1] }} -m pip install --break-system-packages --find-links=wheelhouse/ --no-index --force-reinstall aerospike
Expand Down Expand Up @@ -509,9 +507,7 @@ jobs:
with:
name: ${{ matrix.python[0] }}-win_amd64.build

- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/setup-config-conf

- name: Install wheel
run: python${{ matrix.python[1] }} -m pip install aerospike --force-reinstall --no-index --find-links=./
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/test-ce-for-local-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 'Test local build'

on:
workflow_call:
inputs:
python-version:
required: true
type: string
docker-image:
required: true
type: string
secrets:
DOCKER_HUB_BOT_USERNAME:
required: true
DOCKER_HUB_BOT_PW:
required: true

jobs:
test-local-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}
architecture: 'x64'

- uses: actions/download-artifact@v3
with:
name: wheel-${{ inputs.python-version }}

- name: Install client
run: pip install *.whl

- name: Install test dependencies
run: pip install -r test/requirements.txt

- name: Create config file using template
run: cp config.conf.template config.conf
working-directory: test

- if: ${{ endsWith(inputs.docker-image, '-rc') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
password: ${{ secrets.DOCKER_HUB_BOT_PW }}

- name: Run Aerospike server
run: docker run -d --name aerospike -p 3000-3002:3000-3002 ${{ inputs.docker-image }}:latest

- name: Wait for database to be ready
# Should be ready after 3 seconds
run: sleep 3

- name: Run tests
run: python -m pytest ./new_tests
working-directory: test
6 changes: 2 additions & 4 deletions .github/workflows/test-server-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Start Docker Engine
run: colima start

- uses: ./.github/actions/run-ee-server
- uses: ./.github/actions/run-ee-server-and-setup-config-conf
with:
use-server-rc: true
server-tag: latest
Expand Down Expand Up @@ -167,9 +167,7 @@ jobs:
- name: Run server RC
run: docker run -d -p 3000:3000 --name aerospike ${{ vars.SERVER_RC_REPO_LINK }}

- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/setup-config-conf

- name: Wait for server to be ready
run: sleep 5
Expand Down
Loading