Skip to content

[DPE-5767] - Add CI workflows #23

[DPE-5767] - Add CI workflows

[DPE-5767] - Add CI workflows #23

Workflow file for this run

# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
build:
name: Build snap
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
test:
name: Test snap
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo snap install yq
- name: Download snap package(s)
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true
- name: Install snap package(s) and start the etcd service
run: |
sudo snap install --dangerous charmed-etcd*.snap
sudo snap start charmed-etcd.etcd
- name: Check etcd service status and run etcdctl and etcdutl
run: |
sudo systemctl status snap.charmed-etcd.etcd.service | grep 'active (running)'
# Wait for etcd to start and listen on port 2379
sleep 5
expected_version="$(cat snap/snapcraft.yaml | yq .version)"
version="$(curl -L http://localhost:2379/version | yq -p=json .etcdserver)"
if [ "$expected_version" != "$version" ]; then
echo "Error: etcd Version is ${version}, expected ${expected_version}"
exit 1
fi
charmed-etcd.etcdctl version
charmed-etcd.etcdutl version
- name: Run tests
run: |
charmed-etcd.etcdctl endpoint health | grep 'is healthy'
charmed-etcd.etcdctl put greeting "Hello, etcd" | grep 'OK'
charmed-etcd.etcdctl get greeting | grep 'Hello, etcd'
- name: Run Performance checks
run: |
charmed-etcd.etcdctl check perf | grep 'PASS'