Tests for ASTERIXDB-1636 This is a test for the scenario described in the Jira issue. The only thing I have taken liberty with is changing the socket feed to a file one. The test case fails when I revert AqlMetadataProvider to the previous version, and should pass now with this parent.
Change-Id: Ic1521f1d53121b67677778ac123e49e731932c85 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1248 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Taewoo Kim <wangs...@yahoo.com> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/ecba52e0 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/ecba52e0 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/ecba52e0 Branch: refs/heads/master Commit: ecba52e0b9eca4f59b9b7fc082b720d677b4d98d Parents: 0309d51 Author: Ian Maxon <ima...@apache.org> Authored: Wed Oct 5 17:56:07 2016 -0700 Committer: Ian Maxon <ima...@apache.org> Committed: Wed Oct 5 22:17:08 2016 -0700 ---------------------------------------------------------------------- .../installer/test/AsterixRestartIT.java | 102 +++++++++++++++++++ .../resources/integrationts/restart/828.h1w.adm | 100 ++++++++++++++++++ .../issue-1636/issue-1636.01.ddl.aql | 81 +++++++++++++++ .../issue-1636/issue-1636.02.ddl.aql | 27 +++++ .../issue-1636/issue-1636.03.script.aql | 1 + .../issue-1636/issue-1636.04.ddl.aql | 35 +++++++ .../issue-1636/issue-1636.05.mgx.aql | 2 + .../issue-1636/issue-1636.06.mgx.aql | 2 + .../issue-1636/issue-1636.07.script.aql | 1 + .../issue-1636/issue-1636.08.ddl.aql | 27 +++++ .../issue-1636/issue-1636.09.sleep.aql | 25 +++++ .../issue-1636/issue-1636.10.script.aql | 1 + .../issue-1636/issue-1636.11.script.aql | 1 + .../scripts/feed-restart/issue-1636/cat.sh | 18 ++++ .../scripts/feed-restart/issue-1636/grep_log.sh | 20 ++++ .../feed-restart/issue-1636/kill_cc_and_nc.sh | 18 ++++ .../scripts/feed-restart/issue-1636/touch.sh | 21 ++++ .../integrationts/restart/testsuite.xml | 28 +++++ .../resources/integrationts/restart/tweets.json | 39 +++++++ 19 files changed, 549 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ecba52e0/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixRestartIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixRestartIT.java b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixRestartIT.java new file mode 100644 index 0000000..6d7eaa4 --- /dev/null +++ b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixRestartIT.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.asterix.installer.test; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.apache.asterix.event.model.AsterixInstance.State; +import org.apache.asterix.test.aql.TestExecutor; +import org.apache.asterix.test.base.RetainLogsRule; +import org.apache.asterix.testframework.context.TestCaseContext; +import org.apache.commons.lang3.StringUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; + +//This is just a simple derivative of all of the other IT test cases specifically for test cases which revolve around +//some behavior where stopping and starting Asterix causes issues +public class AsterixRestartIT { + + private static final String PATH_BASE = "src/test/resources/integrationts/restart/"; + private static final String PATH_ACTUAL = "target" + File.separator + "ittest" + File.separator; + private static final Logger LOGGER = Logger.getLogger(AsterixRestartIT.class.getName()); + private static List<TestCaseContext> testCaseCollection; + private static String reportPath = new File( + StringUtils.join(new String[] { "target", "failsafe-reports" }, File.separator)).getAbsolutePath(); + + private final TestExecutor testExecutor = new TestExecutor(); + private static String scriptHomePath; + private static File asterixInstallerPath; + private static ProcessBuilder pb; + private static Map<String, String> env; + + @Rule + public TestRule retainLogs = new RetainLogsRule(AsterixInstallerIntegrationUtil.getManagixHome(), reportPath); + + @BeforeClass + public static void setUp() throws Exception { + try { + pb = new ProcessBuilder(); + env = pb.environment(); + asterixInstallerPath = new File(System.getProperty("user.dir")); + scriptHomePath = asterixInstallerPath + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "integrationts" + File.separator + "restart" + + File.separator + "scripts"; + env.put("SCRIPT_HOME", scriptHomePath); + AsterixInstallerIntegrationUtil.init(); + AsterixInstallerIntegrationUtil.transformIntoRequiredState(State.ACTIVE); + TestCaseContext.Builder b = new TestCaseContext.Builder(); + testCaseCollection = b.build(new File(PATH_BASE)); + } catch (Throwable th) { + th.printStackTrace(); + throw th; + } + } + + @AfterClass + public static void tearDown() throws Exception { + AsterixInstallerIntegrationUtil.deinit(); + } + + @Test + public void test() throws Exception { + for (TestCaseContext testCaseCtx : testCaseCollection) { + testExecutor.executeTest(PATH_ACTUAL, testCaseCtx, pb, false); + } + + } + + public static void main(String[] args) throws Exception { + try { + setUp(); + new AsterixRestartIT().test(); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.info("TEST CASES FAILED"); + } finally { + tearDown(); + } + } + +}