-
Notifications
You must be signed in to change notification settings - Fork 0
feat(framework): remove --keystore-factory support from FullNode #19
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
base: develop
Are you sure you want to change the base?
Changes from all commits
74bbf32
1e9ab92
eb184f3
dd8d4b4
bcdd33c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,13 +20,16 @@ | |
| import com.typesafe.config.ConfigFactory; | ||
| import io.grpc.internal.GrpcUtil; | ||
| import io.grpc.netty.NettyServerBuilder; | ||
| import java.io.ByteArrayOutputStream; | ||
| import java.io.PrintStream; | ||
| import java.lang.reflect.InvocationTargetException; | ||
| import java.lang.reflect.Method; | ||
| import java.net.InetAddress; | ||
| import java.util.Arrays; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.junit.After; | ||
| import org.junit.Assert; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
|
|
@@ -48,9 +51,47 @@ public class ArgsTest { | |
| @Rule | ||
| public ExpectedException thrown = ExpectedException.none(); | ||
|
|
||
| @After | ||
| public void tearDown() { | ||
| Args.clearParam(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testRemovedKeystoreFactoryExitsWithMigrationGuidance() throws Exception { | ||
| ByteArrayOutputStream errorOutput = new ByteArrayOutputStream(); | ||
| PrintStream capturedError = new PrintStream(errorOutput, true, "UTF-8"); | ||
| PrintStream originalError = System.err; | ||
|
|
||
| try { | ||
| System.setErr(capturedError); | ||
|
|
||
| TronError exception = Assert.assertThrows(TronError.class, | ||
| () -> Args.setParam(new String[] {"--keystore-factory"}, TestConstants.TEST_CONF)); | ||
|
|
||
| Assert.assertEquals(TronError.ErrCode.PARAMETER_INIT, exception.getErrCode()); | ||
| } finally { | ||
| System.setErr(originalError); | ||
| capturedError.close(); | ||
| } | ||
|
|
||
| String errorMessage = errorOutput.toString("UTF-8"); | ||
| Assert.assertTrue(errorMessage.contains("--keystore-factory was removed.")); | ||
| Assert.assertTrue(errorMessage.contains("Toolkit.jar keystore <new|import|list|update>")); | ||
| Assert.assertTrue(errorMessage.contains( | ||
| "SM2 nodes (crypto.engine = 'sm2'): append --sm2 to commands that create or modify " | ||
| + "a keystore.")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testRemovedKeystoreFactoryRepeatedFlagStillExits() { | ||
| Assert.assertThrows(TronError.class, | ||
| () -> Args.setParam(new String[] {"--keystore-factory", "--keystore-factory"}, | ||
| TestConstants.TEST_CONF)); | ||
| } | ||
|
|
||
| @Test | ||
| public void get() { | ||
| Args.setParam(new String[] {"--keystore-factory"}, TestConstants.TEST_CONF); | ||
| Args.setParam(new String[] {}, TestConstants.TEST_CONF); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Add regression coverage for the tombstone behavior. This test correctly stops asserting the removed runtime state, but no test now verifies 🤖 Prompt for AI Agents |
||
|
|
||
| CommonParameter parameter = Args.getInstance(); | ||
|
|
||
|
|
@@ -122,8 +163,6 @@ public void get() { | |
| Assert.assertEquals(address, | ||
| ByteArray.toHexString(Args.getLocalWitnesses() | ||
| .getWitnessAccountAddress())); | ||
|
|
||
| Assert.assertTrue(parameter.isKeystoreFactory()); | ||
| } | ||
|
|
||
| @Test | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: When
--keystore-factoryis combined with--version,setParamexits 0 before this tombstone check, so scripts can continue as if the removed option were accepted. Perform the removed-option check before the version branch while retaining the intended--helpexception.Prompt for AI agents