Skip to content

Commit 8ad5e95

Browse files
committed
chore: move p2p::conv tests back to stackslib
1 parent 50b0ea3 commit 8ad5e95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+213
-280
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,6 @@ jobs:
121121
- tests::nakamoto_integrations::follower_bootup_across_multiple_cycles
122122
- tests::nakamoto_integrations::utxo_check_on_startup_panic
123123
- tests::nakamoto_integrations::utxo_check_on_startup_recover
124-
- tests::p2p::convergence::test_walk_ring_allow_15
125-
- tests::p2p::convergence::test_walk_ring_15_plain
126-
- tests::p2p::convergence::test_walk_ring_15_pingback
127-
- tests::p2p::convergence::test_walk_ring_15_org_biased
128-
- tests::p2p::convergence::test_walk_line_allowed_15
129-
- tests::p2p::convergence::test_walk_line_15_plain
130-
- tests::p2p::convergence::test_walk_line_15_org_biased
131-
- tests::p2p::convergence::test_walk_line_15_pingback
132-
- tests::p2p::convergence::test_walk_star_allowed_15
133-
- tests::p2p::convergence::test_walk_star_15_plain
134-
- tests::p2p::convergence::test_walk_star_15_pingback
135-
- tests::p2p::convergence::test_walk_star_15_org_biased
136-
- tests::p2p::convergence::test_walk_inbound_line_15
137124
# Do not run this one until we figure out why it fails in CI
138125
# - tests::neon_integrations::bitcoin_reorg_flap
139126
# - tests::neon_integrations::bitcoin_reorg_flap_with_follower

Cargo.lock

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stackslib/Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ siphasher = "0.3.7"
5959
wsts = { workspace = true }
6060
hashbrown = { workspace = true }
6161
rusqlite = { workspace = true }
62-
rstest = { version = "0.17.0", optional = true }
63-
rstest_reuse = { version = "0.5.0", optional = true }
64-
stdext = { version = "0.3.1", optional = true }
65-
stx-genesis = { path = "../stx-genesis", optional = true }
6662

6763
[target.'cfg(not(any(target_os = "macos",target_os="windows", target_arch = "arm" )))'.dependencies]
6864
tikv-jemallocator = {workspace = true}
@@ -99,12 +95,13 @@ features = ["std"]
9995
assert-json-diff = "1.0.0"
10096
criterion = "0.3.5"
10197
stdext = "0.3.1"
102-
stx-genesis = { path = "../stx-genesis" }
98+
stx-genesis = { path = "../stx-genesis"}
10399
clarity = { features = ["default", "testing"], path = "../clarity" }
104100
stacks-common = { features = ["default", "testing"], path = "../stacks-common" }
105101
rstest = "0.17.0"
106102
rstest_reuse = "0.5.0"
107103
mutants = "0.0.3"
104+
rlimit = "0.10.2"
108105

109106
[features]
110107
default = []
@@ -113,7 +110,7 @@ disable-costs = []
113110
developer-mode = ["clarity/developer-mode"]
114111
monitoring_prom = ["prometheus"]
115112
slog_json = ["slog-json", "stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
116-
testing = ["stdext", "rstest", "rstest_reuse", "stx-genesis"]
113+
testing = []
117114

118115
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
119116
sha2 = { version = "0.10", features = ["asm"] }

stackslib/src/burnchains/bitcoin/indexer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl BitcoinIndexerConfig {
167167
}
168168
}
169169

170-
#[cfg(any(test, feature = "testing"))]
170+
#[cfg(test)]
171171
pub fn test_default(spv_headers_path: String) -> BitcoinIndexerConfig {
172172
BitcoinIndexerConfig {
173173
peer_host: "127.0.0.1".to_string(),
@@ -203,7 +203,7 @@ impl BitcoinIndexerRuntime {
203203
}
204204

205205
impl BitcoinIndexer {
206-
#[cfg(any(test, feature = "testing"))]
206+
#[cfg(test)]
207207
pub fn new(
208208
config: BitcoinIndexerConfig,
209209
runtime: BitcoinIndexerRuntime,
@@ -216,7 +216,7 @@ impl BitcoinIndexer {
216216
}
217217
}
218218

219-
#[cfg(any(test, feature = "testing"))]
219+
#[cfg(test)]
220220
pub fn new_unit_test(working_dir: &str) -> BitcoinIndexer {
221221
let mut working_dir_path = PathBuf::from(working_dir);
222222
if fs::metadata(&working_dir_path).is_err() {
@@ -861,7 +861,7 @@ impl BitcoinIndexer {
861861
Ok(new_tip)
862862
}
863863

864-
#[cfg(any(test, feature = "testing"))]
864+
#[cfg(test)]
865865
pub fn raw_store_header(&mut self, header: BurnchainBlockHeader) -> Result<(), btc_error> {
866866
let mut spv_client = SpvClient::new(
867867
&self.config.spv_headers_path,
@@ -887,7 +887,7 @@ impl BitcoinIndexer {
887887
Ok(())
888888
}
889889

890-
#[cfg(any(test, feature = "testing"))]
890+
#[cfg(test)]
891891
pub fn mock_bitcoin_header(
892892
parent_block_hash: &BurnchainHeaderHash,
893893
timestamp: u32,

stackslib/src/burnchains/bitcoin/spv.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl SpvClient {
182182
Ok(client)
183183
}
184184

185-
#[cfg(any(test, feature = "testing"))]
185+
#[cfg(test)]
186186
pub fn new_without_migration(
187187
headers_path: &str,
188188
start_block: u64,
@@ -211,7 +211,7 @@ impl SpvClient {
211211
Ok(client)
212212
}
213213

214-
#[cfg(any(test, feature = "testing"))]
214+
#[cfg(test)]
215215
pub fn disable_check_txcount(&mut self) {
216216
self.check_txcount = false;
217217
}
@@ -220,7 +220,7 @@ impl SpvClient {
220220
&self.headers_db
221221
}
222222

223-
#[cfg(any(test, feature = "testing"))]
223+
#[cfg(test)]
224224
pub fn conn_mut(&mut self) -> &mut DBConn {
225225
&mut self.headers_db
226226
}
@@ -277,7 +277,7 @@ impl SpvClient {
277277
.and_then(|_| Ok(()))
278278
}
279279

280-
#[cfg(any(test, feature = "testing"))]
280+
#[cfg(test)]
281281
pub fn test_db_migrate(conn: &mut DBConn) -> Result<(), btc_error> {
282282
SpvClient::db_migrate(conn)
283283
}
@@ -925,7 +925,7 @@ impl SpvClient {
925925
Ok(())
926926
}
927927

928-
#[cfg(any(test, feature = "testing"))]
928+
#[cfg(test)]
929929
pub fn test_write_block_headers(
930930
&mut self,
931931
height: u64,

stackslib/src/burnchains/burnchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ impl Burnchain {
623623
ret
624624
}
625625

626-
#[cfg(any(test, feature = "testing"))]
626+
#[cfg(test)]
627627
pub fn default_unittest(
628628
first_block_height: u64,
629629
first_block_hash: &BurnchainHeaderHash,

stackslib/src/burnchains/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub mod burnchain;
5757
pub mod db;
5858
pub mod indexer;
5959

60-
#[cfg(any(test, feature = "testing"))]
60+
#[cfg(test)]
6161
pub mod tests;
6262

6363
pub struct Txid(pub [u8; 32]);
@@ -351,7 +351,7 @@ impl PoxConstants {
351351
_shadow: PhantomData,
352352
}
353353
}
354-
#[cfg(any(test, feature = "testing"))]
354+
#[cfg(test)]
355355
pub fn test_default() -> PoxConstants {
356356
// 20 reward slots; 10 prepare-phase slots
357357
PoxConstants::new(
@@ -369,7 +369,7 @@ impl PoxConstants {
369369
)
370370
}
371371

372-
#[cfg(any(test, feature = "testing"))]
372+
#[cfg(test)]
373373
/// Create a PoX constants used in tests with 5-block cycles,
374374
/// 3-block prepare phases, a threshold of 3, rejection fraction of 25%,
375375
/// a participation threshold of 5% and no sunset or transition to pox-2 or beyond.
@@ -821,7 +821,7 @@ impl From<btc_error> for Error {
821821
}
822822

823823
impl BurnchainView {
824-
#[cfg(any(test, feature = "testing"))]
824+
#[cfg(test)]
825825
pub fn make_test_data(&mut self) {
826826
let oldest_height = if self.burn_stable_block_height < MAX_NEIGHBOR_BLOCK_DELAY {
827827
0

stackslib/src/burnchains/tests/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl BurnchainDB {
4949

5050
/// Get back all of the parsed burnchain operations for a given block.
5151
/// Used in testing to replay burnchain data.
52-
#[cfg(any(test, feature = "testing"))]
52+
#[cfg(test)]
5353
pub fn get_burnchain_block_ops(
5454
&self,
5555
block_hash: &BurnchainHeaderHash,

stackslib/src/burnchains/tests/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
#![allow(unused)]
1716

1817
pub mod affirmation;
1918
pub mod burnchain;

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5482,7 +5482,7 @@ impl<'a> SortitionHandleTx<'a> {
54825482
sn.canonical_stacks_tip_height,
54835483
)?;
54845484

5485-
#[cfg(any(test, feature = "testing"))]
5485+
#[cfg(test)]
54865486
{
54875487
let (block_consensus_hash, block_bhh) =
54885488
SortitionDB::get_canonical_stacks_chain_tip_hash(self).unwrap();
@@ -6566,7 +6566,7 @@ impl ChainstateDB for SortitionDB {
65666566
}
65676567
}
65686568

6569-
#[cfg(any(test, feature = "testing"))]
6569+
#[cfg(test)]
65706570
pub mod tests {
65716571
use std::sync::mpsc::sync_channel;
65726572
use std::thread;

0 commit comments

Comments
 (0)