fix lastUnixUserId - 3rd try

This commit is contained in:
Michael Hoennig 2024-10-07 17:22:44 +02:00
parent 03b720251a
commit 05ffbac882

View File

@ -157,7 +157,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
)
);
final var givenParentAsset = givenParentAsset(MANAGED_SERVER, "vm1011");
final var expectedUnixUserId = lastUnixUserId();
final var expectedUnixUserId = nextUnixUserId();
final var location = RestAssured // @formatter:off
.given()
@ -208,9 +208,11 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
.isEqualTo("""
HsHostingAsset(UNIX_USER, fir10, fir10 webspace user, MANAGED_WEBSPACE:fir10, {
"password" : null,
"userid" : 1000000
"userid" : {lastUnixUserId}
})
""".trim());
"""
.replace("{lastUnixUserId}", expectedUnixUserId.toString())
.trim());
}
@Test
@ -781,10 +783,10 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
}
private Integer lastUnixUserId() {
final Object result = em.createNativeQuery("SELECT last_value from hs_hosting.asset_unixuser_system_id_seq", Integer.class)
private Integer nextUnixUserId() {
final Object result = em.createNativeQuery("SELECT nextval('hs_hosting.asset_unixuser_system_id_seq')", Integer.class)
.getSingleResult();
return (Integer) result;
return (Integer) result + 1;
}
}