forked from tronprotocol/java-tron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestConstants.java
More file actions
39 lines (34 loc) · 1.74 KB
/
TestConstants.java
File metadata and controls
39 lines (34 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.tron.common;
import static org.junit.Assume.assumeFalse;
import org.tron.common.arch.Arch;
/**
* Centralized test environment constants and utilities.
*
* <h3>DB engine override for dual-engine testing</h3>
* Gradle tasks ({@code test} on ARM64, {@code testWithRocksDb}) set the JVM system property
* {@code -Dstorage.db.engine=ROCKSDB}. Because test config files are loaded from the classpath
* via {@code ConfigFactory.load(fileName)}, Typesafe Config automatically merges system
* properties with higher priority than the config file values. This means the config's
* {@code storage.db.engine = "LEVELDB"} is overridden transparently, without any code changes
* in individual tests.
*
* <p><b>IMPORTANT:</b> Config files MUST be classpath resources (in {@code src/test/resources/}),
* NOT standalone files in the working directory. If a config file exists on disk,
* {@code Configuration.getByFileName} falls back to {@code ConfigFactory.parseFile()},
* which does NOT merge system properties, and the engine override will silently fail.
*/
public class TestConstants {
public static final String TEST_CONF = "config-test.conf";
public static final String NET_CONF = "config.conf";
public static final String MAINNET_CONF = "config-test-mainnet.conf";
public static final String DBBACKUP_CONF = "config-test-dbbackup.conf";
public static final String LOCAL_CONF = "config-localtest.conf";
public static final String STORAGE_CONF = "config-test-storagetest.conf";
public static final String INDEX_CONF = "config-test-index.conf";
/**
* Skips the current test on ARM64 where LevelDB JNI is unavailable.
*/
public static void assumeLevelDbAvailable() {
assumeFalse("LevelDB JNI unavailable on ARM64", Arch.isArm64());
}
}