new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItVoyagerSample.java
@Test
  @DisplayName("Create the Voyager ingress and test Voyager load balancing with host name-based routing")
  @Slow
  @MustNotRunInParallel
  public void testVoyagerWorks() {
    String ingressName = domainUid + "-ingress-host-routing";
    String ingressServiceName = VOYAGER_CHART_NAME + "-" + ingressName;
    String channelName = "tcp-80";
    ExecResult result = null;

    // create Voyager ingress resource
    Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    List<String>  hostNames =
        installVoyagerIngressAndVerify(domainUid, domainNamespace, ingressName, clusterNameMsPortMap);

    // get ingress service Nodeport
    int ingressServiceNodePort = assertDoesNotThrow(()
        -> getServiceNodePort(domainNamespace, ingressServiceName, channelName),
            "Getting admin server node port failed");
    logger.info("Node port for {0} is: {1} :", ingressServiceName, ingressServiceNodePort);

    // invoke webapp
    String curlRequest = String.format("curl --silent --show-error --noproxy '*' "
        + "-H 'host: %s' http://%s:%s/sample-war/index.jsp",
            hostNames.get(0), K8S_NODEPORT_HOST, ingressServiceNodePort);
    logger.info("Exec curl command :" + curlRequest);
    try {
      result = ExecCommand.exec(curlRequest, true);
    } catch (Exception ex) {
      logger.info("Got exception while running command: {0}", curlRequest);
      fail("Failed to process curl command " + ex.getMessage());
    }

    assertNotNull(result, "curl command returns null");
    logger.info("curl command returns: \n{0}, \n{1}", result.stdout(), result.stderr());
    assertTrue(result.stdout().contains("Hello World"), "Failed to invoke the webapp");
  }
/**
   * The test invokes a webapp to verify the Voyager is installed successfully and ready to use.
   */
The test invokes a webapp to verify the Voyager is installed successfully and ready to use.
The test invokes a webapp to verify the Voyager is installed successfully and ready to use .
@Test
  @DisplayName("Create the Voyager ingress and test Voyager load balancing with host name-based routing")
  @Slow
  @MustNotRunInParallel
  public void testVoyagerWorks() {
    String ingressName = domainUid + "-ingress-host-routing";
    String ingressServiceName = VOYAGER_CHART_NAME + "-" + ingressName;
    String channelName = "tcp-80";
    ExecResult result = null;
    Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    List<String>  hostNames =
        installVoyagerIngressAndVerify(domainUid, domainNamespace, ingressName, clusterNameMsPortMap);
    int ingressServiceNodePort = assertDoesNotThrow(()
        -> getServiceNodePort(domainNamespace, ingressServiceName, channelName),
            "Getting admin server node port failed");
    logger.info("Node port for {0} is: {1} :", ingressServiceName, ingressServiceNodePort);
    String curlRequest = String.format("curl --silent --show-error --noproxy '*' "
        + "-H 'host: %s' http://%s:%s/sample-war/index.jsp",
            hostNames.get(0), K8S_NODEPORT_HOST, ingressServiceNodePort);
    logger.info("Exec curl command :" + curlRequest);
    try {
      result = ExecCommand.exec(curlRequest, true);
    } catch (Exception ex) {
      logger.info("Got exception while running command: {0}", curlRequest);
      fail("Failed to process curl command " + ex.getMessage());
    }
    assertNotNull(result, "curl command returns null");
    logger.info("curl command returns: \n{0}, \n{1}", result.stdout(), result.stderr());
    assertTrue(result.stdout().contains("Hello World"), "Failed to invoke the webapp");
  }
@ Test @ DisplayName ( "Create the Voyager ingress and test Voyager load balancing with host name-based routing" ) @ Slow @ MustNotRunInParallel public void testVoyagerWorks ( ) { String ingressName = domainUid + "-ingress-host-routing" ; String ingressServiceName = VOYAGER_CHART_NAME + "-" + ingressName ; String channelName = "tcp-80" ; ExecResult result = null ; Map < String , Integer > clusterNameMsPortMap = new HashMap < > ( ) ; clusterNameMsPortMap . put ( clusterName , managedServerPort ) ; List < String > hostNames = installVoyagerIngressAndVerify ( domainUid , domainNamespace , ingressName , clusterNameMsPortMap ) ; int ingressServiceNodePort = assertDoesNotThrow ( ( ) -> getServiceNodePort ( domainNamespace , ingressServiceName , channelName ) , "Getting admin server node port failed" ) ; logger . info ( "Node port for {0} is: {1} :" , ingressServiceName , ingressServiceNodePort ) ; String curlRequest = String . format ( "curl --silent --show-error --noproxy '*' " + "-H 'host: %s' http://%s:%s/sample-war/index.jsp" , hostNames . get ( 0 ) , K8S_NODEPORT_HOST , ingressServiceNodePort ) ; logger . info ( "Exec curl command :" + curlRequest ) ; try { result = ExecCommand . exec ( curlRequest , true ) ; } catch ( Exception ex ) { logger . info ( "Got exception while running command: {0}" , curlRequest ) ; fail ( "Failed to process curl command " + ex . getMessage ( ) ) ; } assertNotNull ( result , "curl command returns null" ) ; logger . info ( "curl command returns: \n{0}, \n{1}" , result . stdout ( ) , result . stderr ( ) ) ; assertTrue ( result . stdout ( ) . contains ( "Hello World" ) , "Failed to invoke the webapp" ) ; }
The test invokes a webapp to verify the Voyager is installed successfully and ready to use.
The test invokes a webapp to verify the Voyager is installed successfully and ready to use .
// create Voyager ingress resource // get ingress service Nodeport // invoke webapp