Working on add-on trying to update from 4.3.3 to 5.1.x and can't build

I have been working on a updated dd-wrt plugin based on ssh. I started back when my installed version was 4.3.3 and I was able to build and test. Now I want to update to 5.0.x but have not been able to get any build to work on main even without my changes

mvn clean install

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.3:test (default-test) on project org.openhab.binding.astro: There are test failures.

build environment

$ git log -1 --oneline
539f52715c (HEAD → main, origin/main, origin/HEAD) [openaitts] Add new voices, model and configuration (#19122)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.3 LTS
Release: 24.04
Codename: noble

$ mvn --version
Apache Maven 3.8.7
Maven home: /usr/share/maven
Java version: 21.0.8, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “6.14.0-27-generic”, arch: “amd64”, family: “unix”

Your Git checkout is old (September 3) and unluckily for you, there was something wrong with that commit.

If you look here, and scroll down to the commit you’ve checked out, you can see that there are test failures for that commit:

Update your branch to the latest commit (currently f817cb086a10502f9c96b9e25f5851bdb491b8b4) and try again.

In addition, for less problems, build without checks and tests until you’re ready to submit a PR, I typically use:

mvn clean install -nsu -T1C -DskipTests -DskipChecks -Dspotless.check.skip=true

This is also much faster, but still not fast, because you’re building all the add-ons. To build only one, use:

mvn clean install -nsu -T1C -DskipTests -DskipChecks -Dspotless.check.skip=true -pl :org.openhab.binding.YOURBINDING

Updated to the latest and still see test failures. I guess I had the wrong impression that all tests were passing on the upstream builds. Looks like Jenkins is skipping some tests. I just wanted to make sure I had a good build environment before I started rebasing. I’ll use this skip options to get passed this.

ERROR] Failures:
[ERROR] DateTimeUtilsTest.testGetSeasonAmsterdam:56->assertNextSeason:87 Should return the expected season name. ==> expected: <java.util.GregorianCalendar[time=1614578400000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2021,MONTH=2,WEEK_OF_YEAR=10,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=60,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]> but was: <java.util.GregorianCalendar[time=1606802400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=336,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]>
[ERROR] DateTimeUtilsTest.testGetSeasonSydney:67->assertNextSeason:87 Should return the expected season name. ==> expected: <java.util.GregorianCalendar[time=1614578400000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2021,MONTH=2,WEEK_OF_YEAR=10,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=60,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]> but was: <java.util.GregorianCalendar[time=1606802400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=336,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]>

$ git log -1
commit f817cb086a10502f9c96b9e25f5851bdb491b8b4 (HEAD → main, upstream/main, origin/main, origin/HEAD)
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon Sep 8 16:20:03 2025 +0200

They usually are, there were some dependency updates that caused trouble (which isn’t too rare).

I’m not sure what you’re thinking of here, but the GitHub runner should run them all. The particular test that fails for you, don’t fail for me. It would, I guess, be interesting to figure out why it fails for you, if it has to do with your default Locale or something like that. Any test that relies on default Locale is bugged as far as I’m concerned, but we don’t know if that’s the case here.

Ultimately, it only matters how the binding you’re working on builds - including test failures. I would never build all add-ons when working on an add-on, use the -pl option.

When pasting code, logs, etc., use “code fences” (3 x `), not “quote” (>) - as what you’ve pasted above is hardly readable. I had to copy and paste it into an editor to be able to make any sense of it.

1 Like

It would be nice if you could check if the following fixes the test for you:

 .../openhab/binding/astro/internal/util/DateTimeUtilsTest.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/bundles/org.openhab.binding.astro/src/test/java/org/openhab/binding/astro/internal/util/DateTimeUtilsTest.java b/bundles/org.openhab.binding.astro/src/test/java/org/openhab/binding/astro/internal/util/DateTimeUtilsTest.java
index 1fa3e4ba3e..61dcae6bf0 100644
--- a/bundles/org.openhab.binding.astro/src/test/java/org/openhab/binding/astro/internal/util/DateTimeUtilsTest.java
+++ b/bundles/org.openhab.binding.astro/src/test/java/org/openhab/binding/astro/internal/util/DateTimeUtilsTest.java
@@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.TimeZone;
 
 import org.junit.jupiter.api.BeforeEach;
@@ -75,8 +76,8 @@ public class DateTimeUtilsTest {
         Calendar truncated = DateTimeUtils.truncateToMidnight(cal);
         assertEquals(truncated, target);
         Calendar endOfDay = DateTimeUtils.endOfDayDate(cal);
-        Calendar target2 = new GregorianCalendar(2021, 9, 30, 23, 59, 59);
-        target2.setTimeZone(TIME_ZONE);
+        Calendar target2 = newCalendar(2021, 9, 30, 23, 59, TIME_ZONE);
+        target2.set(Calendar.SECOND, 59);
         target2.set(Calendar.MILLISECOND, 999);
         assertEquals(endOfDay, target2);
     }
@@ -89,8 +90,9 @@ public class DateTimeUtilsTest {
     }
 
     private static Calendar newCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute, TimeZone zone) {
-        Calendar result = new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute);
-        result.setTimeZone(zone);
+        Calendar result = new GregorianCalendar(zone, Locale.ROOT);
+        result.set(Calendar.MILLISECOND, 0);
+        result.set(year, month, dayOfMonth, hourOfDay, minute, 0);
 
         return result;
     }

I think that gets rid of the default Locale dependency, which I suspect is what’s causing the test failure.

applied the patch then “mvn install -rf :org.openhab.binding.astro” still failing test.

[INFO] Running org.openhab.binding.astro.internal.util.DateTimeUtilsTest
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.015 s <<< FAILURE! – in org.openhab.binding.astro.internal.util.DateTimeUtilsTest
[ERROR] org.openhab.binding.astro.internal.util.DateTimeUtilsTest.testGetSeasonAmsterdam – Time elapsed: 0.006 s <<< FAILURE!
org.opentest4j.AssertionFailedError: Should return the expected season name. ==> expected: <java.util.GregorianCalendar[time=1614578400000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2021,MONTH=2,WEEK_OF_YEAR=10,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=60,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]> but was: <java.util.GregorianCalendar[time=1606802400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=336,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at org.openhab.binding.astro.internal.util.DateTimeUtilsTest.assertNextSeason(DateTimeUtilsTest.java:88)
at org.openhab.binding.astro.internal.util.DateTimeUtilsTest.testGetSeasonAmsterdam(DateTimeUtilsTest.java:57)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

[ERROR] org.openhab.binding.astro.internal.util.DateTimeUtilsTest.testGetSeasonSydney – Time elapsed: 0.002 s <<< FAILURE!
org.opentest4j.AssertionFailedError: Should return the expected season name. ==> expected: <java.util.GregorianCalendar[time=1614578400000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2021,MONTH=2,WEEK_OF_YEAR=10,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=60,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]> but was: <java.util.GregorianCalendar[time=1606802400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=“America/Chicago”,offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=336,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=0]>
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
at org.openhab.binding.astro.internal.util.DateTimeUtilsTest.assertNextSeason(DateTimeUtilsTest.java:88)
at org.openhab.binding.astro.internal.util.DateTimeUtilsTest.testGetSeasonSydney(DateTimeUtilsTest.java:68)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Yeah, I’ve since found that this “fix” probably isn’t sufficient, and that much more is needed:

https://github.com/openhab/openhab-addons/pull/19310#issuecomment-3273130946

Could you please use code fences instead of quote when you paste output? It’s just not readable as a quote.

This PR has now been merged:

https://github.com/openhab/openhab-addons/pull/19310

If you update to latest main, I think the test failure should be gone.

@Lee_Ballard Feedback as to whether the problem has been solved would be helpful.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.