Skip to content
Snippets Groups Projects
Unverified Commit c5edee5f authored by jimin's avatar jimin Committed by GitHub
Browse files

optimize: optimize ParameterParserTest test case failed (#3365)

parent 1903ac60
No related branches found
No related tags found
No related merge requests found
......@@ -24,14 +24,14 @@ import io.seata.config.ConfigurationFactory;
import io.seata.core.constants.ConfigurationKeys;
import io.seata.server.env.ContainerHelper;
import static io.seata.config.ConfigurationFactory.ENV_PROPERTY_KEY;
import static io.seata.common.DefaultValues.SERVER_DEFAULT_PORT;
import static io.seata.common.DefaultValues.SERVER_DEFAULT_STORE_MODE;
import static io.seata.config.ConfigurationFactory.ENV_PROPERTY_KEY;
/**
* The type Parameter parser.
*
* @author xingfudeshi@gmail.com
* @author xingfudeshi @gmail.com
*/
public class ParameterParser {
......@@ -51,6 +51,7 @@ public class ParameterParser {
@Parameter(names = {"--seataEnv", "-e"}, description = "The name used for multi-configuration isolation.",
order = 5)
private String seataEnv;
/**
* Instantiates a new Parameter parser.
*
......@@ -154,4 +155,13 @@ public class ParameterParser {
return seataEnv;
}
/**
* Clean up.
*/
public void cleanUp() {
if (null != System.getProperty(ENV_PROPERTY_KEY)) {
System.clearProperty(ENV_PROPERTY_KEY);
}
}
}
......@@ -43,6 +43,7 @@ public class ParameterParserTest {
@Test
public void testEmptyMode() {
String[] args = new String[] {"-h", "127.0.0.1", "-p", "8088"};
parameterParser.cleanUp();
parameterParser = new ParameterParser(args);
//always set store.mode=file in test/resource/file.conf, if not will cause SessionStoreTest's case fail.
Assertions.assertEquals("file", parameterParser.getStoreMode());
......@@ -85,7 +86,10 @@ public class ParameterParserTest {
*/
@AfterEach
public void cleanUp() {
parameterParser = null;
if (null != parameterParser) {
parameterParser.cleanUp();
parameterParser = null;
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment