-
Enhancement
-
Resolution: Done
-
Major
-
None
YamlExtensionTestCase is asserting test cases by inspecting concrete log traces, for example:
@Test public void testUndefineNonExistentAttributeYamlOperations() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { container.startYamlExtension(new PrintStream(byteArrayOutputStream), new Path[]{testUndefineNonExistentAttributeYamlOperations}); Assert.fail("Server must not start with non-existent attribute."); } catch (RuntimeException ex) { Assert.assertFalse("Server must not start with non-existent attribute.", container.isStarted()); String expectedConsoleOutput = "ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation (\"undefine-attribute\") failed - address: ([\n" + " (\"socket-binding-group\" => \"standard-sockets\"),\n" + " (\"socket-binding\" => \"txn-status-manager\")\n" + "]) - failure description: \"WFLYCTL0201: Unknown attribute 'asfds'\""; assertThat("Server log must contain ERROR with information which attribute is wrong.", byteArrayOutputStream.toString(), CoreMatchers.containsString(expectedConsoleOutput)); } }
This makes the code harder to maintain. Instead, it should use the message ID and maybe other specific patterns using a regular expression, but we should avoid checking exact error traces.
- relates to
-
WFCORE-7169 Add OperationContext.Stage info to ControllerLogger.operationFailed methods
-
- Resolved
-