Skip to content

Commit

Permalink
fix: tests fail randomly because of KeyGenerator
Browse files Browse the repository at this point in the history
THe tests fail sometimes, because no explicit key length is given. The
docs specify that there is no guarantee about the exact implementation
on any given platform. Using a specific length is recommended.
  • Loading branch information
borisrizov-zf committed Aug 28, 2023
1 parent 05c8b69 commit 96ca03d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public class TestContextInitializer implements ApplicationContextInitializer<Con
public void initialize(ConfigurableApplicationContext applicationContext) {
KEYCLOAK_CONTAINER.start();
String authServerUrl = KEYCLOAK_CONTAINER.getAuthServerUrl();
SecretKey secretKey = KeyGenerator.getInstance("AES").generateKey();
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
// use explicit initialization as the platform default might fail
keyGen.init(128);
SecretKey secretKey = keyGen.generateKey();
TestPropertyValues.of(
"server.port=" + port,
"miw.host: localhost:${server.port}",
Expand Down

0 comments on commit 96ca03d

Please sign in to comment.