Skip to content

Istiocdxaction #1771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 2, 2020
Merged

Istiocdxaction #1771

merged 16 commits into from
Jul 2, 2020

Conversation

bhavaniravichandran
Copy link
Member

Test to confirm cross domain transaction works when istio is enabled.

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@DisplayName("Verify cross domain transaction with istio enabled is successful")
@IntegrationTest
public class ItIstioCrossDomainTransaction implements LoggedTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more implements LoggedTest
Please see PR #1765
Now you need to get logger here and initialize it in initAll method.

private static LoggingFacade logger = null;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sync'd a few minutes ago and was working on changing this.
done.

/**
* Install Operator.
* @param namespaces list of namespaces created by the IntegrationTestWatcher by the
* JUnit engine parameter resolution mechanism
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now a simple description is good enough I guess

Suggested change
* JUnit engine parameter resolution mechanism
@param namespaces injected by JUnit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
@BeforeAll
public static void initAll(@Namespaces(3) List<String> namespaces) {
// create standard, reusable retry/backoff policy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need logger initialized here
logger = getLogger();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

installIstio();

// get a new unique opNamespace
logger.info("Creating unique namespace for Operator");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.info("Creating unique namespace for Operator");
logger.info("Assigning a unique namespace for Operator");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

assertNotNull(namespaces.get(0), "Namespace list is null");
opNamespace = namespaces.get(0);

logger.info("Creating unique namespace for Domain");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Test
@DisplayName("Check cross domain transaction with istio works")
@Slow
@MustNotRunInParallel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these 2 tags?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to keep it there for now. There is an issue with the istio service port number which might cause a problem if the istio tests are run in parallel. Will remove it later after that issue is resolved..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MustNotRunInParallel tag may not help. We need find other solution such as adding host name to the istio service to provide host information in http header.

logger.info("\n HTTP response is \n " + result.stdout());
logger.info("curl command returned {0}", result.toString());
assertTrue(result.stdout().contains("Status=Committed"), "crossDomainTransaction failed");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to use java based http client?

String url= String.format("
"http://%s:%s/TxForward/TxForward?urls=t3://%s.%s:7001,t3://%s1.%s:8001,t3://%s1.%s:8001,"
+ "t3://%s2.%s:8001",
K8S_NODEPORT_HOST, istioIngressPort, domain1AdminServerPodName, domain1Namespace,
domain1ManagedServerPrefix, domain1Namespace, domain2ManagedServerPrefix,domain2Namespace,
domain2ManagedServerPrefix,domain2Namespace);

HttpResponse response = assertDoesNotThrow(() -> OracleHttpClient.get(url, true));
assertEquals(200, response.statusCode(), "Status code not equals to 200");
assertTrue(response.body().contains(""Status=Committed"), "crossDomainTransaction failed");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to use the http client

logger.info("Check for managed server pod {0} existence in namespace {1}",
managedServerPrefix + i, domainNamespace);
checkPodExists(managedServerPrefix + i, domainUid, domainNamespace);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need the podExists checks because podReady will do both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be in this order.

  1. admin service check
  2. admin pod ready check
  3. ms service check
  4. ms pod ready check

logger.info("Check managed server service {0} is created in namespace {1}",
managedServerPrefix + i, domainNamespace);
checkServiceExists(managedServerPrefix + i, domainNamespace);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkServiceExists should be done before checkPodReady

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved it up.

}, "Access to admin server node port failed");
assertTrue(loginSuccessful, "Console login validation failed");

*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted

Copy link
Member

@sankarpn sankarpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more change needed

logger.info("Check for managed server pod {0} existence in namespace {1}",
managedServerPrefix + i, domainNamespace);
checkPodExists(managedServerPrefix + i, domainUid, domainNamespace);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be in this order.

  1. admin service check
  2. admin pod ready check
  3. ms service check
  4. ms pod ready check

Copy link
Member

@sankarpn sankarpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@bhavaniravichandran
Copy link
Member Author

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
//import java.net.http.HttpResponse;
Copy link
Member

@rjeberhard rjeberhard Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove, please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

int istioIngressPort = getIstioHttpIngressPort();
logger.info("Istio Ingress Port is {0}", istioIngressPort);

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove any unnecessary code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra spaces

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to get the test to pass on Kind cluster and tried to see if retry works. Didn't want to remove the commented code till I found the solution. Finally passed in kind cluster. So, removed all commented code.

Copy link
Member

@rjeberhard rjeberhard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Before commit, please do remove any commented out imports or code and resolve the conflict.

@bhavaniravichandran
Copy link
Member Author

Do not merge yet.

@bhavaniravichandran
Copy link
Member Author

bhavaniravichandran commented Jul 2, 2020

istio: ingressgateway
servers:
- hosts:
- '*'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Host information

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

- match:
- uri:
prefix: /console
- uri:
Copy link
Member

@anpanigr anpanigr Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this uri prefix ? You are not using any REST API to configure domain

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean the management prefix. I guess not. Will remove it.


- match:
- uri:
prefix: /TxForward
Copy link
Member

@anpanigr anpanigr Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only difference between this template and existing istio-http-template.yaml. We can make the application prefix as replaceable and use the same template

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also want to prefix my hostname with the domain name and namespace - not to have conflicts later - if we have 2 domains in the same namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I have to deploy my app to the AS as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping it separate for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping it separate for now.

}

/*
* This test verifies cross domain transaction is successful. domain in image using wdt is used
Copy link
Member

@anpanigr anpanigr Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testname should be modified to testIstioCrossDomainTransaction()
The description does not refers to ISTIO
The description should give more details about the transaction with description of control flow inside the application. This is the only document we refers when the test fails.

For example

  1. Configure two WebLogic Domain(s) with following transnational resources.
  2. Start a 2PC transaction
  3. Enlist a JDBC/JMS Resources from a Server on domain1
  4. Enlist a another transnational resource from domain2
  5. Commit the Transaction

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the test name and added more description

Copy link
Member

@anpanigr anpanigr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rjeberhard rjeberhard merged commit 291a16c into develop Jul 2, 2020
@rjeberhard rjeberhard deleted the istiocdxaction branch January 5, 2021 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants