DBZ-6827 Testing farm onboarding

This commit is contained in:
Ondrej Babec 2023-07-25 11:16:18 +02:00 committed by Ondrej Babec
parent 9e585e29d9
commit f03eda1cc4
9 changed files with 667 additions and 1 deletions

6
.fmf/README.md Normal file
View File

@ -0,0 +1,6 @@
## FMF
Flexible Metadata Format [(doc)](https://fmf.readthedocs.io/en/stable/overview.html#description)
This [folder](.) and version [file](version) are required for testing-farm and packit integration.
To see more information about testing-farm please read this [documentation](../debezium-testing/tmt/README.md).

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

351
.packit.yaml Normal file
View File

@ -0,0 +1,351 @@
# Default packit instance is a prod and only this is used
# stg instance is present for testing new packit features in forked repositories where stg is installed.
packit_instances: ["prod", "stg"]
upstream_project_url: https://github.com/debezium/debezium
issue_repository: https://github.com/debezium/debezium
jobs:
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "postgres-12-decoderbufs"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- postgres
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 12
DECODER_PLUGIN: decoderbufs
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "postgres-12-pgoutput"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- postgres
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 12
DECODER_PLUGIN: pgoutput
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "postgres-15-decoderbufs"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- postgres
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 15
DECODER_PLUGIN: decoderbufs
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "postgres-15-pgoutput"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- postgres
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 15
DECODER_PLUGIN: pgoutput
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mysql-8-none"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mysql
tf_extra_params:
test:
tmt:
name: mysql
environments:
- variables:
MYSQL_VERSION: 8.0.32
PROFILE: none
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mysql-8-assembly"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mysql
tf_extra_params:
test:
tmt:
name: mysql
environments:
- variables:
MYSQL_VERSION: 8.0.32
PROFILE: assembly
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mysql-5-none"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mysql
tf_extra_params:
test:
tmt:
name: mysql
environments:
- variables:
MYSQL_VERSION: 5.7
PROFILE: none
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mysql-5-assembly"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mysql
tf_extra_params:
test:
tmt:
name: mysql
environments:
- variables:
MYSQL_VERSION: 5.7
PROFILE: assembly
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "sqlserver-2017"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- sqlserver
tf_extra_params:
test:
tmt:
name: sqlserver
environments:
- variables:
SQL_SERVER_VERSION: 2017
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "sqlserver-2022"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- sqlserver
tf_extra_params:
test:
tmt:
name: sqlserver
environments:
- variables:
SQL_SERVER_VERSION: 2022
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mongodb-4"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mongodb
tf_extra_params:
test:
tmt:
name: mongodb
environments:
- variables:
MONGODB_VERSION: 4.4
TEST_PROFILE: mongodb
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mongodb-5"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mongodb
tf_extra_params:
test:
tmt:
name: mongodb
environments:
- variables:
MONGODB_VERSION: 5.0
TEST_PROFILE: mongodb
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "mongodb-6"
targets:
- centos-stream-8-x86_64
skip_build: true
manual_trigger: true
labels:
- mongodb
tf_extra_params:
test:
tmt:
name: mongodb
environments:
- variables:
MONGODB_VERSION: 6.0
TEST_PROFILE: mongodb
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "oracle-21"
targets:
centos-stream-8-x86_64:
distros: ["debezium-tf-2130"]
skip_build: true
manual_trigger: true
labels:
- oracle
tf_extra_params:
test:
tmt:
name: oracle
environments:
- variables:
ORACLE_VERSION: 21.3.0
TEST_PROFILE: oracle
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "oracle-21-xs"
targets:
centos-stream-8-x86_64:
distros: [ "debezium-tf-2130-xs" ]
skip_build: true
manual_trigger: true
labels:
- oracle
tf_extra_params:
test:
tmt:
name: oracle
environments:
- variables:
ORACLE_VERSION: 21.3.0-xs
TEST_PROFILE: oracle
ORACLE_ARG: "-Poracle-xstream"
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "oracle-19"
targets:
centos-stream-8-x86_64:
distros: [ "debezium-tf-1930" ]
skip_build: true
manual_trigger: true
labels:
- oracle
tf_extra_params:
test:
tmt:
name: oracle
environments:
- variables:
ORACLE_VERSION: 19.3.0
TEST_PROFILE: oracle
###############################################################################################
- job: tests
trigger: pull_request
# Suffix for job name
identifier: "oracle-19-xs"
targets:
centos-stream-8-x86_64:
distros: [ "debezium-tf-1930-xs" ]
skip_build: true
manual_trigger: true
labels:
- oracle
tf_extra_params:
test:
tmt:
name: oracle
environments:
- variables:
ORACLE_VERSION: 19.3.0-xs
TEST_PROFILE: oracle
ORACLE_ARG: "-Poracle-xstream"
###############################################################################################

View File

@ -252,7 +252,7 @@
<configuration> <configuration>
<skipTests>${skipITs}</skipTests> <skipTests>${skipITs}</skipTests>
<enableAssertions>true</enableAssertions> <enableAssertions>true</enableAssertions>
<forkCount>1</forkCount> <forkCount>0</forkCount>
<argLine>-Djava.library.path=${instantclient.dir} -Ddebezium.embedded.shutdown.pause.before.interrupt.ms=20000 -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl</argLine> <argLine>-Djava.library.path=${instantclient.dir} -Ddebezium.embedded.shutdown.pause.before.interrupt.ms=20000 -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl</argLine>
<systemPropertyVariables> <systemPropertyVariables>
<database.connection.adapter>${adapter.name}</database.connection.adapter> <database.connection.adapter>${adapter.name}</database.connection.adapter>

View File

@ -0,0 +1,72 @@
# Testing farm
This document gives a detailed breakdown of the testing processes using testing farm service.
## Pre-requisites
* Python >=3.9
* TMT command line tool (optional) - for lint and check tmt formatted test plans and tests
* `pip install tmt[all]`
* Testing farm command line tool - for trigger your test plan in testing-farm
* `pip install tft-cli`
## Links
* [Test Management Tool (tmt)](https://tmt.readthedocs.io/en/latest/index.html)
* [Testing farm](https://docs.testing-farm.io/general/0.1/index.html)
## Current plans and tests
Plans are stored in [plans](./plans) folder, there are files called `main.fmf`, and `oracle.fmf` which contain test plan definitions.
This definition is composed of hw requirements, prepare steps for created VM executor and specific plans. Specific
plan defines selectors for [tests](./tests) which should be executed.
### List of plans
* mysql
* postgres
* oracle
* sqlserver
* mongodb
## Usage
### Pre-requisites
1. Get API token for testing farm [(how-to obtain token)](https://docs.testing-farm.io/general/0.1/onboarding.html)
2. Store token into env var ```export TESTING_FARM_API_TOKEN="your_token"```
### Run tests
Run all plans
```commandline
testing-farm request --compose CentOS-Stream-8 --git-url https://github.com/debezium/debezium.git
```
Select specific plan and git branch
```commandline
testing-farm request --compose CentOS-Stream-8 \
--git-url https://github.com/debezium/debezium.git \
--git-ref some-branch \
--plan mysql
```
## Packit-as-a-service for PR check
[Packit-as-a-service](https://github.com/marketplace/packit-as-a-service) is a GitHub application
for running testing-farm jobs from PR requested by command. Definition of the jobs is stored in
[.packit.yaml](../../.packit.yaml). Packit can be triggered from the PR by comment, but only members of Debezium
organization are able to run tests.
### Usage
Run all jobs for PR
```
/packit test
```
Run selected jobs by label
```
/packit test --labels mysql,postgres
```
Run selected job by identifier
```
/packit test --identifier mysql-8-assembly
```

View File

@ -0,0 +1,100 @@
# TMT test plan definition
# https://tmt.readthedocs.io/en/latest/overview.html
# Baseline common for all test plans
#######################################################################
summary: Debezium functional testsuite
discover:
how: fmf
# Required HW
provision:
hardware:
memory: ">= 24 GiB"
cpu:
processors: ">= 8"
# Install required packages and scripts for running debezium suite
prepare:
- name: Install packages
how: install
package:
- wget
- java-17-openjdk-devel
- xz
- make
- git
- zip
- coreutils
- name: Install docker-ce
how: shell
script: |
OS=$(cat /etc/redhat-release || true)
if [[ ${OS} == *"CentOS"* ]]; then
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
else
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
fi
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo systemctl enable docker --now
- name: Install mvn
how: shell
script: |
mkdir -p /usr/share/maven /usr/share/maven/ref
curl -fsSL -o /tmp/apache-maven.tar.gz https://apache.osuosl.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz
tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1
rm -f /tmp/apache-maven.tar.gz
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
# Discover tmt defined tests in tests/ folder
execute:
how: tmt
#######################################################################
/mysql:
summary: Run mysql connector functional tests
provision:
hardware:
memory: ">= 16 GiB"
cpu:
processors: ">= 4"
discover+:
test:
- mysql
/postgres:
summary: Run postgresql connector functional tests
provision:
hardware:
memory: ">= 16 GiB"
cpu:
processors: ">= 4"
discover+:
test:
- postgres
/sqlserver:
summary: Run sqlserver connector functional tests
provision:
hardware:
memory: ">= 16 GiB"
cpu:
processors: ">= 4"
discover+:
test:
- sqlserver
/mongodb:
summary: Run mongodb connector functional tests
provision:
hardware:
memory: ">= 16 GiB"
cpu:
processors: ">= 4"
discover+:
test:
- mongodb

View File

@ -0,0 +1,39 @@
# TMT test plan definition
# https://tmt.readthedocs.io/en/latest/overview.html
# Baseline common for all test plans
#######################################################################
summary: Debezium oracle functional testsuite
discover:
how: fmf
# Required HW
provision:
hardware:
memory: ">= 32 GiB"
cpu:
processors: ">= 16"
# Install required packages and scripts for running debezium suite
prepare:
- name: Start docker-ce
how: shell
script: |
sudo systemctl enable docker --now
# Discover tmt defined tests in tests/ folder
execute:
how: tmt
#######################################################################
/oracle:
summary: Run oracle connector functional tests
provision:
hardware:
memory: ">= 32 GiB"
cpu:
processors: ">= 16"
discover+:
test:
- oracle

View File

@ -0,0 +1,45 @@
test:
./test.sh
duration: 2h
environment:
MAVEN_ARGS: "-U -am -fae -Papicurio -Dinsecure.repositories=WARN -pl debezium-bom"
/mysql:
summary: Run mysql connector functional tests
tags: [debezium, mysql]
duration: 4h
tier: 2
environment+:
TEST_PROFILE: mysql
/postgres:
summary: Run postgresql connector functional tests
tags: [debezium, postgresql]
duration: 4h
tier: 2
environment+:
TEST_PROFILE: postgres
/oracle:
summary: Run oracle connector functional tests
tags: [debezium, oracle]
duration: 4h
tier: 1
environment+:
TEST_PROFILE: oracle
/sqlserver:
summary: Run sqlserver connector functional tests
tags: [debezium, sqlserver]
duration: 4h
tier: 2
environment+:
TEST_PROFILE: sqlserver
/mongodb:
summary: Run mongodb connector functional tests
tags: [debezium, mongodb]
duration: 4h
tier: 2
environment+:
TEST_PROFILE: mongodb

View File

@ -0,0 +1,52 @@
#!/bin/sh -eux
cd ../../../..
echo $PWD
if [ "$TEST_PROFILE" = "mysql" ]
then
mvn clean install ${MAVEN_ARGS},debezium-connector-mysql \
-Dversion.mysql.server=${MYSQL_VERSION} \
-Dmysql.port=4301 \
-Dmysql.replica.port=4301 \
-Dmysql.gtid.port=4302 \
-Dmysql.gtid.replica.port=4303 \
-P${PROFILE}
elif [ "$TEST_PROFILE" = "postgres" ]
then
mvn clean install ${MAVEN_ARGS},debezium-connector-postgres \
-Dpostgres.port=55432 \
-Dversion.postgres.server=${POSTGRESQL_VERSION} \
-Ddecoder.plugin.name=${DECODER_PLUGIN} \
-Dtest.argline="-Ddebezium.test.records.waittime=5"
elif [ "$TEST_PROFILE" = "oracle" ]
then
source ${HOME}/install-oracle-driver.sh
export LD_LIBRARY_PATH=$ORACLE_ARTIFACT_DIR
mvn clean install -U-pl debezium-connector-oracle -am -fae \
-Poracle-tests \
${ORACLE_ARG:-} \
-Ddatabase.hostname=0.0.0.0 \
-Ddatabase.admin.hostname=0.0.0.0 \
-Dinstantclient.dir=${ORACLE_ARTIFACT_DIR} \
-Dinsecure.repositories=WARN \
-Ddatabase.user="c##dbzuser" \
-Papicurio
elif [ "$TEST_PROFILE" = "sqlserver" ]
then
if [ "$SQL_SERVER_VERSION" = "2017" ]
then
export DATABASE_IMAGE="mcr.microsoft.com/mssql/server:2017-latest"
else
export DATABASE_IMAGE="mcr.microsoft.com/mssql/server:2022-latest"
fi
mvn clean install ${MAVEN_ARGS},debezium-connector-sqlserver \
-Ddocker.db="${DATABASE_IMAGE}"
else
mvn clean install ${MAVEN_ARGS},debezium-connector-mongodb \
-Dversion.mongo.server=${MONGODB_VERSION}
fi