javapackages-validator-tests

Created 2 years ago
Maintained by mkoncek
A repository to host tmt tests and configuration files for java packages using validator tool
Members 2
Mikolaj Izdebski committed 2 years ago

javapackages-validator-tests

This repository contains files used for testing Fedora Java packages using the tool javapackages-validator and to store configuration files for that tool.

Contents

  • src/ -- Configuration .java files, described later.
  • jp_validator.sh -- The script which calls the validator tool.
  • tests.fmf -- The main .fmf file containing metadata for all tests.

How it works

The test uses an optional environment variable, TEST_ARTIFACTS, which can used to specify the path to RPMs. This allows local test execution.

The test analyzes the contents of .rpm files. The framework used by Fedora provides a standard location /var/share/test-artifacts which contains all the RPMs of the package that is being tested.

Unless overriden, tests obtain the image javapckages-validator from quay.io and execute it using podman. This is done in jp_validator.sh.

Configuration

The behaviour of the tests is configured in 3 places:

  1. The actual source code. We strive to keep it generic.
  2. The .fmf configuration files used in each package repository. We strive to keep them as small as possible.
  3. Most of the configuration should be done in this repository in the src/ directory.

Custom test configuration is handled by using standard Java interfaces. The tests refer to interfaces and the actual implementations are compiled by validator.

Implementation is then obtained using reflection by constructing configuration classes using an empty constructor. Validator detects which interfaces the compiled classes implement and uses this information to configure checks.

It is possible to use multiple configurations for a simple check. In that case, the check is executed as many times as the number of configuration classes that resulted from compilation of the config sources.