Skip to content

PBM coverage profiling #255

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

Merged
merged 3 commits into from
Dec 18, 2024
Merged
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
41 changes: 33 additions & 8 deletions .github/workflows/PBM.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PBM
name: PBM Coverage Report

on:
workflow_dispatch:
Expand All @@ -16,15 +16,16 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
test: [logical, physical, incremental]
test: [logical, physical, incremental, external]
env:
PSMDB: ${{ github.event.inputs.psmdb || 'percona/percona-server-mongodb' }}
PBM_BRANCH: ${{ github.event.inputs.pbm_branch || 'dev' }}
GO_VER: ${{ github.event.inputs.go_ver || 'bullseye' }}
MAKE_TARGET: 'build-cover'
steps:
- uses: actions/checkout@v4
- name: Setup environment with PSMDB ${{ env.PSMDB }} and PBM branch ${{ env.PBM_BRANCH }}
Expand All @@ -34,10 +35,34 @@ jobs:
working-directory: ./pbm-functional/pytest
- name: Test ${{ matrix.test }} backup/restore on PSMDB ${{ env.PSMDB }} PBM branch ${{ env.PBM_BRANCH }}
run: |
docker compose run --rm test pytest -s --junitxml=junit.xml -k ${{ matrix.test }}
docker compose run --rm test pytest -s --junitxml=junit.xml -k ${{ matrix.test }} || true
docker compose run --rm golang_reports cp -r /gocoverdir/reports /test
sudo chmod -R 777 reports
working-directory: ./pbm-functional/pytest
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
- name: Archive reports
uses: actions/upload-artifact@v4
with:
report_paths: '**/junit.xml'
name: reports-${{ matrix.test }}
path: pbm-functional/pytest/reports/
coverage:
env:
PBM_BRANCH: ${{ github.event.inputs.pbm_branch || 'dev' }}
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all reports
uses: actions/download-artifact@v4
with:
path: reports
pattern: reports-*
merge-multiple: true
- name: Pull golang image
run: |
docker pull golang
- name: Print func coverage for PBM branch ${{ env.PBM_BRANCH }}
run: |
docker run -v .:/test --rm golang go tool covdata func -i /test/reports
- name: Print percent coverage for PBM branch ${{ env.PBM_BRANCH }}
run: |
docker run -v .:/test --rm golang go tool covdata percent -i /test/reports
5 changes: 3 additions & 2 deletions pbm-functional/pytest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ FROM pykmip/local AS pykmip
FROM golang:$GO_VER AS builder
ARG PBM_BRANCH=dev
ARG PR_NUMBER
ARG MAKE_TARGET=build
WORKDIR /
RUN mkdir -p /pbm-old && mkdir -p /pbm-new && \
apt update && apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit && \
git clone https://github.com/percona/percona-backup-mongodb.git && cd percona-backup-mongodb && \
if [ -n "$PR_NUMBER" ]; then git fetch origin pull/$PR_NUMBER/head:CURRENT_PR; PBM_BRANCH=CURRENT_PR; fi && \
git checkout $PBM_BRANCH && \
make build && cp -rpf bin/* /pbm-new/ && rm -rf bin && \
make $MAKE_TARGET && cp -rpf bin/* /pbm-new/ && rm -rf bin && \
git reset --hard && \
git branch -r | grep release | sed 's/origin\///'| grep -v $PBM_BRANCH | sort --version-sort | tail -1 | xargs git checkout && \
git pull && \
make build && cp -rpf bin/* /pbm-old/ && rm -rf bin
make $MAKE_TARGET && cp -rpf bin/* /pbm-old/ && rm -rf bin

FROM $PSMDB
USER root
Expand Down
15 changes: 9 additions & 6 deletions pbm-functional/pytest/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ def create(self):
detach=True,
network='test',
environment=["PBM_MONGODB_URI=" + pbm_mongodb_uri, "DATADIR=" + self.mongod_datadir, "KRB5_KTNAME=/keytabs/" + host['host'] + "/mongodb.keytab",
"MONGODB_EXTRA_ARGS= --port 27017 --replSet " + self.config['_id'] + " --keyFile /etc/keyfile " + self.mongod_extra_args],
volumes=["fs:/backups","keytabs:/keytabs"]
"MONGODB_EXTRA_ARGS= --port 27017 --replSet " + self.config['_id'] + " --keyFile /etc/keyfile " + self.mongod_extra_args,
"GOCOVERDIR=/gocoverdir/reports"],
volumes=["fs:/backups","keytabs:/keytabs","gocoverdir:/gocoverdir"]
)
if "arbiterOnly" in host:
if host['arbiterOnly']:
Expand All @@ -288,8 +289,9 @@ def create(self):
detach=True,
network='test',
environment=["PBM_MONGODB_URI=" + pbm_mongodb_uri, "DATADIR=" + self.mongod_datadir, "KRB5_KTNAME=/keytabs/" + host['host'] + "/mongodb.keytab",
"MONGODB_EXTRA_ARGS= --port 27017 --replSet " + shard['_id'] + " --shardsvr --keyFile /etc/keyfile " + self.mongod_extra_args, "KRB5_TRACE=/dev/stderr"],
volumes=["fs:/backups","keytabs:/keytabs"]
"MONGODB_EXTRA_ARGS= --port 27017 --replSet " + shard['_id'] + " --shardsvr --keyFile /etc/keyfile " + self.mongod_extra_args, "KRB5_TRACE=/dev/stderr",
"GOCOVERDIR=/gocoverdir/reports"],
volumes=["fs:/backups","keytabs:/keytabs","gocoverdir:/gocoverdir"]
)
if 'arbiterOnly' in host:
if host['arbiterOnly']:
Expand All @@ -311,8 +313,9 @@ def create(self):
network='test',
environment=["PBM_MONGODB_URI=" + pbm_mongodb_uri, "DATADIR=" + self.mongod_datadir, "KRB5_KTNAME=/keytabs/" + host['host'] + "/mongodb.keytab",
"MONGODB_EXTRA_ARGS= --port 27017 --replSet " +
self.config['configserver']['_id'] + " --configsvr --keyFile /etc/keyfile " + self.mongod_extra_args],
volumes=["fs:/backups","keytabs:/keytabs"]
self.config['configserver']['_id'] + " --configsvr --keyFile /etc/keyfile " + self.mongod_extra_args,
"GOCOVERDIR=/gocoverdir/reports"],
volumes=["fs:/backups","keytabs:/keytabs","gocoverdir:/gocoverdir"]
)
if "arbiterOnly" in host:
if host['arbiterOnly']:
Expand Down
11 changes: 11 additions & 0 deletions pbm-functional/pytest/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,21 @@ services:
- GO_VER=${GO_VER:-bullseye}
- PSMDB=${PSMDB:-percona/percona-server-mongodb:latest}
- PR_NUMBER=${PR_NUMBER:-}
- MAKE_TARGET=${MAKE_TARGET:-build}
environment:
- "PERCONA_TELEMETRY_URL=https://check-dev.percona.com/v1/telemetry/GenericReport"
command: /bin/bash
depends_on:
- pykmip

golang_reports:
image: golang:bullseye
command: >
/bin/sh -c " mkdir -p /gocoverdir/reports; chmod -R 777 /gocoverdir/reports; exit 0; "
volumes:
- .:/test
- gocoverdir:/gocoverdir

networks:
test:
name: test
Expand All @@ -141,3 +150,5 @@ volumes:
name: fs
keytabs:
name: keytabs
gocoverdir:
name: gocoverdir
Loading