-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] use randomized runner in packaging tests (#32109)
Use the randomized runner from the test framework and add some basic logging to make the packaging tests behave more similarly to how we use junit in the rest of the project
- Loading branch information
1 parent
15ff3da
commit e20f59a
Showing
3 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
qa/vagrant/src/main/java/org/elasticsearch/packaging/test/PackagingTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch 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.elasticsearch.packaging.test; | ||
|
||
import com.carrotsearch.randomizedtesting.JUnit3MethodProvider; | ||
import com.carrotsearch.randomizedtesting.RandomizedRunner; | ||
import com.carrotsearch.randomizedtesting.annotations.TestMethodProviders; | ||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.rules.TestName; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(RandomizedRunner.class) | ||
@TestMethodProviders({ | ||
JUnit3MethodProvider.class | ||
}) | ||
/** | ||
* Class that all packaging test cases should inherit from. This makes working with the packaging tests more similar to what we're | ||
* familiar with from {@link org.elasticsearch.test.ESTestCase} without having to apply its behavior that's not relevant here | ||
*/ | ||
public abstract class PackagingTestCase { | ||
|
||
protected final Log logger = LogFactory.getLog(getClass()); | ||
|
||
@Rule | ||
public final TestName testNameRule = new TestName(); | ||
|
||
@Before | ||
public void logTestNameBefore() { | ||
logger.info("[" + testNameRule.getMethodName() + "]: before test"); | ||
} | ||
} |