Skip to content
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

Fix test skipping logic for workflow builds #3566

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void validateETagConcurrentHandlingTestCaseForPatchMethod() throws Except

@Test(groups = "wso2.dss", description = "etag concurrent handling with delete method test", dependsOnMethods = "validateETagConcurrentHandlingTestCaseForPatchMethod")
public void validateETagConcurrentHandlingTestCaseForDeleteMethod() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
System.out.println("This test is temporarily skipped for this workflow");
String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES";
String content = "{\"FILENAME\": \"WSO2PROD\" ,\"TYPE\" : \"dss\"}";
Expand Down Expand Up @@ -278,8 +278,7 @@ public void validateETagConcurrentHandlingTestCaseForDeleteMethod() throws Excep
@Test(groups = "wso2.dss", description = "property modification using etag concurrent handling with put method test", dependsOnMethods = "validateETagConcurrentHandlingTestCaseForDeleteMethod")
public void validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPutMethod() throws Exception {
// To insert values
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
System.out.println("This test is temporarily skipped for this workflow");
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES";
String content = "{\"FILENAME\": \"WSO2PROD\" ,\"TYPE\" : \"dss\"}";
Map<String, String> headers = new HashMap<>();
Expand Down Expand Up @@ -333,7 +332,7 @@ public void validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPutMethod

@Test(groups = "wso2.dss", description = "property modification using etag concurrent handling with patch method test", dependsOnMethods = "validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPutMethod")
public void validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPatchMethod() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
System.out.println("This test is temporarily skipped for this workflow");
String entityEndpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2PROD\')";
String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2PROD\')/TYPE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void testMoreNumberThanMaximum() throws IOException, XMLStreamException {

@Test(groups = { "wso2.esb" }, description = "less number of messages than maximum count")
public void testLessNumberThanMaximum() throws IOException, XMLStreamException {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
int responseCount = 0;

no_of_requests = 60;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void uploadSynapseConfig() throws Exception {

@Test(groups = {"wso2.esb"}, description = "Test ForEach mediator with JSON payload")
public void testForEachMediatorWithJSONPayload() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
String request = "{\"getQuote\":{\"request\":[{\"symbol\":\"IBM\"},{\"symbol\":\"WSO2\"},{\"symbol\":\"MSFT\"}]}}";

simpleHttpClient = new SimpleHttpClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,32 +296,34 @@ public void testMIRestart() throws IOException, AutomationUtilException, Interru
@Test(groups = {"wso2.esb"}, description = "Test service catalog with proxy services", priority = 11)
public void testServiceCatalogProxyServiceMetadata()
throws CarbonException, IOException, AutomationUtilException, InterruptedException {
File metadataCAPP = new File(getESBResourceLocation() + File.separator
+ SERVICE_CATALOG_FOLDER + File.separator + CAPP_WITH_PROXY_META);
serverConfigurationManager.copyToCarbonapps(metadataCAPP);
// replace server startup scripts
String shFile = CarbonBaseUtils.getCarbonHome() + File.separator + "bin" + File.separator + SH_FILE_NAME;
String batFile = CarbonBaseUtils.getCarbonHome() + File.separator + "bin" + File.separator + BAT_FILE_NAME;
File oldShFile = new File( shFile + ".backup");
File newShFile = new File(shFile);
if (new File(shFile).delete() && oldShFile.renameTo(newShFile)) {
assertTrue(newShFile.exists(), "Error while replacing default sh script");
}
File oldBatFile = new File( batFile + ".backup");
File newBatFile = new File(batFile);
if (new File(batFile).delete() && oldBatFile.renameTo(newBatFile)) {
assertTrue(newBatFile.exists(), "Error while replacing default bat script");
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
File metadataCAPP = new File(getESBResourceLocation() + File.separator
+ SERVICE_CATALOG_FOLDER + File.separator + CAPP_WITH_PROXY_META);
serverConfigurationManager.copyToCarbonapps(metadataCAPP);
// replace server startup scripts
String shFile = CarbonBaseUtils.getCarbonHome() + File.separator + "bin" + File.separator + SH_FILE_NAME;
String batFile = CarbonBaseUtils.getCarbonHome() + File.separator + "bin" + File.separator + BAT_FILE_NAME;
File oldShFile = new File(shFile + ".backup");
File newShFile = new File(shFile);
if (new File(shFile).delete() && oldShFile.renameTo(newShFile)) {
assertTrue(newShFile.exists(), "Error while replacing default sh script");
}
File oldBatFile = new File(batFile + ".backup");
File newBatFile = new File(batFile);
if (new File(batFile).delete() && oldBatFile.renameTo(newBatFile)) {
assertTrue(newBatFile.exists(), "Error while replacing default bat script");
}
serverConfigurationManager.restartMicroIntegrator();
assertTrue(Utils.checkForLog(carbonLogReader,
"Successfully updated the service catalog", 10), "Did not receive the expected info log");
File extracted = chekAndExtractPayloadZip();
assertTrue(extracted.exists(), "Error occurred while extracting the ZIP");
File metadataFile = new File(extracted, "SampleProxyService_proxy_v1.0.0");
File yamlFile = new File(metadataFile, "metadata.yaml");
assertTrue(yamlFile.exists(), "Could not find the metadata yaml file");
File wsdlFile = new File(metadataFile, "definition.wsdl");
assertTrue(wsdlFile.exists(), "Could not find the definition wsdl file");
}
serverConfigurationManager.restartMicroIntegrator();
assertTrue(Utils.checkForLog(carbonLogReader,
"Successfully updated the service catalog", 10), "Did not receive the expected info log");
File extracted = chekAndExtractPayloadZip();
assertTrue(extracted.exists(), "Error occurred while extracting the ZIP");
File metadataFile = new File(extracted, "SampleProxyService_proxy_v1.0.0");
File yamlFile = new File(metadataFile, "metadata.yaml");
assertTrue(yamlFile.exists(), "Could not find the metadata yaml file");
File wsdlFile = new File(metadataFile, "definition.wsdl");
assertTrue(wsdlFile.exists(), "Could not find the definition wsdl file");
}

private static File chekAndExtractPayloadZip() throws CarbonException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void init() throws Exception {

@Test(groups = { "wso2.esb" }, description = "Test proxy service with jms transport")
public void testMessageInjection() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
String queueName = "jmsQueue";
int numberOfMsgToExpect = 10;
TimeUnit.SECONDS.sleep(15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected void init() throws Exception {

@Test(groups = "wso2.esb", description = "Test adding OMElements as properties when saving messages to the MessageStore")
public void testAddingOMElementPropertyToMessageStore() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
AxisServiceClient client = new AxisServiceClient();
client.sendRobust(Utils.getStockQuoteRequest("IBM"), getProxyServiceURLHttp("testPS"), "getQuote");
Assert.assertTrue(carbonLogReader.checkForLog(GET_QUOTE_REQUEST_BODY, DEFAULT_TIMEOUT), "OMElement is not saved to the message store");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void init() throws Exception {

@Test(groups = { "wso2.esb" }, description = "Test Cron Forwarding of message processor")
public void testMessageProcessorCronForwader() throws Exception {
if (System.getenv("CI_BUILD_SKIP").equals("true")) {
if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) {
// SEND THE REQUEST
String addUrl = getProxyServiceURLHttp("MSMPRetrytest");
String payload = "{\"name\":\"Jack\"}";
Expand Down
Loading