Best Testcontainers-java code snippet using org.testcontainers.junit.GenericContainerRuleTest.extraHostTest
Source:GenericContainerRuleTest.java
...216 assertEquals("Stderr for \"redis-cli role\" command should be empty", "", result.getStderr());217 // We expect to reach this point for modern Docker versions.218 }219 @Test220 public void extraHostTest() throws IOException {221 BufferedReader br = getReaderForContainerPort80(GenericContainerRuleTest.alpineExtrahost);222 // read hosts file from container223 StringBuffer hosts = new StringBuffer();224 String line = br.readLine();225 while (line != null) {226 hosts.append(line);227 hosts.append("\n");228 line = br.readLine();229 } 230 Matcher matcher = Pattern.compile("^192.168.1.10\\s.*somehost", Pattern.MULTILINE).matcher(hosts.toString());231 assertTrue("The hosts file of container contains extra host", matcher.find());232 }233 @Test234 public void createContainerCmdHookTest() {...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!