Skip to content

Commit

Permalink
Merge pull request #13312 from chamilaadhi/oom-test
Browse files Browse the repository at this point in the history
OOM Test case
  • Loading branch information
chamilaadhi authored Dec 22, 2023
2 parents c8fbffe + 455be03 commit fa52253
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.am.integration.tests.logging;

import static org.junit.Assert.assertFalse;

import java.io.File;

import org.testng.annotations.Test;
import org.wso2.am.integration.tests.api.lifecycle.APIManagerLifecycleBaseTest;
import org.wso2.carbon.utils.ServerConstants;

public class OOMLogsCheckTest extends APIManagerLifecycleBaseTest {
@Test(groups = { "wso2.am" }, description = "Test whether a heapdump is generated due to OOM issue")
public void testAvailabilityOfHeapDumpTestcase() throws Exception {
String heapdumpFile = System.getProperty(ServerConstants.CARBON_HOME) + File.separator + "repository"
+ File.separator + "logs" + File.separator + "heap-dump.hprof";

File file = new File(heapdumpFile);
assertFalse("A Heapdump file is present in " + heapdumpFile + ". This possibly indicates an issue during startup / OSGi resolution.", file.exists());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<classes>
<class name="org.wso2.am.integration.tests.server.mgt.APIMgtServerStartupTestCase"/>
<class name="org.wso2.am.integration.tests.server.mgt.OSGIServerBundleStatusTestCase"/>
<class name="org.wso2.am.integration.tests.logging.OOMLogsCheckTest"/>
<!--<class name="org.wso2.am.integration.tests.login.LoginValidationTestCase"/>-->
</classes>
</test>
Expand Down

0 comments on commit fa52253

Please sign in to comment.