Add tests subpackage

This commit is contained in:
Marian Koncek 2025-03-04 16:37:47 +01:00
commit d4b3f61bb0
2 changed files with 40 additions and 3 deletions

10
plans/smoke.fmf Normal file
View file

@ -0,0 +1,10 @@
summary: Basic smoke test
discover:
how: fmf
url: https://src.fedoraproject.org/tests/postgresql-jdbc
prepare:
how: install
package:
- java-21-openjdk-devel
execute:
how: tmt

View file

@ -61,6 +61,7 @@ Provides: pgjdbc = %version-%release
BuildRequires: maven-local
BuildRequires: mvn(com.ongres.scram:scram-client)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-api)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-engine)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-params)
@ -88,6 +89,12 @@ Summary: API docs for %{name}
%description javadoc
This package contains the API Documentation for %{name}.
%package tests
Summary: Tests for %{name}
%description tests
This package contains tests for %{name}.
%prep
%autosetup -p1 -n postgresql-%{version}-jdbc-src
@ -114,6 +121,17 @@ rm src/test/java/org/postgresql/test/jdbc2/DriverTest.java \
src/test/java/org/postgresql/jdbcurlresolver/PgPassParserTest.java \
src/test/java/org/postgresql/util/StubEnvironmentAndProperties.java
# Install -tests Jar as well
%pom_xpath_inject 'pom:build/pom:plugins/pom:plugin[pom:artifactId="maven-jar-plugin"]' '
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>'
%mvn_package org.postgresql:postgresql::tests: tests
%build
# Ideally we would run "sh update-translations.sh" here, but that results
# in inserting the build timestamp into the generated messages_*.class
@ -143,19 +161,28 @@ EOF
# Start the local PG cluster.
%postgresql_tests_start
%else
# -f is equal to -Dmaven.test.skip=true
opts="-f"
# NOTE this parameter skips running tests but still compiles them
opts="-- -DskipTests=true"
%endif
%mvn_build $opts --xmvn-javadoc
%mvn_build $opts
xmvn -Dmdep.outputFile=tests-classpath dependency:build-classpath --offline
%install
%mvn_install
install -m 644 -D tests-classpath %{buildroot}/%{_datadir}/%{name}-tests/classpath
install -m 644 -D -t %{buildroot}/%{_datadir}/%{name}-tests build.properties ssltest.properties
cp -r -t %{buildroot}/%{_datadir}/%{name}-tests certdir
%files -f .mfiles
%license LICENSE
%doc README.md
%files tests -f .mfiles-tests
%{_datadir}/%{name}-tests
%license LICENSE
%files javadoc -f .mfiles-javadoc
%license LICENSE