Skip to content
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

fix: fix StateMinerSectors tests #5154

Merged
merged 9 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/tests/api_compare/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ services:
--forest $$FOREST_API_INFO \
--lotus $$LOTUS_API_INFO \
--n-tipsets 10 \
--test-criteria-overrides=valid-and-timeout,timeout-and-timeout \
--filter-file /data/filter-list \
--miner-address ${MINER_ADDRESS} \
--worker-address ${MINER_WORKER_ADDRESS}
Expand Down
2 changes: 0 additions & 2 deletions scripts/tests/api_compare/filter-list
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@
!Filecoin.EthGetTransactionReceiptLimited
# TODO: https://github.com/ChainSafe/forest/issues/5006
!Filecoin.EthGetBlockReceipts
# TODO: https://github.com/ChainSafe/forest/issues/5100
!Filecoin.StateMinerSectors
2 changes: 0 additions & 2 deletions scripts/tests/api_compare/filter-list-offline
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@
!Filecoin.EthGetTransactionReceiptLimited
# TODO: https://github.com/ChainSafe/forest/issues/5006
!Filecoin.EthGetBlockReceipts
# TODO: https://github.com/ChainSafe/forest/issues/5100
!Filecoin.StateMinerSectors
24 changes: 22 additions & 2 deletions src/tool/subcommands/api_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ pub enum ApiCommands {
/// Specify a directory to which the RPC tests are dumped
#[arg(long)]
dump_dir: Option<PathBuf>,

/// Additional overrides to modify success criteria for tests
#[arg(long, num_args = 0.., default_values_t = [TestCriteriaOverride::TimeoutAndTimeout])]
test_criteria_overrides: Vec<TestCriteriaOverride>,
},
GenerateTestSnapshot {
/// Path to test dumps that are generated by `forest-tool api dump-tests` command
Expand Down Expand Up @@ -219,6 +223,7 @@ impl ApiCommands {
max_concurrent_requests,
create_tests_args,
dump_dir,
test_criteria_overrides,
} => {
let forest = Arc::new(rpc::Client::from_url(forest));
let lotus = Arc::new(rpc::Client::from_url(lotus));
Expand All @@ -237,6 +242,7 @@ impl ApiCommands {
run_ignored,
fail_fast,
dump_dir.clone(),
&test_criteria_overrides,
)
.await?;
}
Expand Down Expand Up @@ -367,6 +373,14 @@ pub struct CreateTestsArgs {
snapshot_files: Vec<PathBuf>,
}

#[derive(ValueEnum, Debug, Copy, Clone, strum_macros::Display, PartialEq)]
pub enum TestCriteriaOverride {
/// Test pass when first endpoint returns a valid result and the second one timeout
ValidAndTimeout,
/// Test pass when both endpoints timeout
TimeoutAndTimeout,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Dialogue {
method: String,
Expand Down Expand Up @@ -1890,6 +1904,7 @@ async fn run_tests(
run_ignored: RunIgnored,
fail_fast: bool,
dump_dir: Option<PathBuf>,
test_criteria_overrides: &[TestCriteriaOverride],
) -> anyhow::Result<()> {
let forest = Into::<Arc<rpc::Client>>::into(forest);
let lotus = Into::<Arc<rpc::Client>>::into(lotus);
Expand Down Expand Up @@ -1957,8 +1972,13 @@ async fn run_tests(
let forest_status = test_result.forest_status;
let lotus_status = test_result.lotus_status;
let success = match (&forest_status, &lotus_status) {
(TestSummary::Valid, TestSummary::Valid)
| (TestSummary::Timeout, TestSummary::Timeout) => true,
(TestSummary::Valid, TestSummary::Valid) => true,
(TestSummary::Valid, TestSummary::Timeout) => {
test_criteria_overrides.contains(&TestCriteriaOverride::ValidAndTimeout)
}
(TestSummary::Timeout, TestSummary::Timeout) => {
test_criteria_overrides.contains(&TestCriteriaOverride::TimeoutAndTimeout)
}
(TestSummary::Rejected(ref reason_forest), TestSummary::Rejected(ref reason_lotus)) => {
match test.policy_on_rejected {
PolicyOnRejected::Pass => true,
Expand Down
1 change: 1 addition & 0 deletions src/tool/subcommands/api_cmd/test_snapshots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ filecoin_stategetallocation_1733735082114977.rpcsnap.json.zst
filecoin_stategetallocationforpendingdeal_1733735082149029.rpcsnap.json.zst
filecoin_stategetallocationidforpendingdeal_1733735082161045.rpcsnap.json.zst
filecoin_stategetallocations_1733735082163772.rpcsnap.json.zst
filecoin_stateminersectors_1737107834478196.rpcsnap.json.zst
LesnyRumcajs marked this conversation as resolved.
Show resolved Hide resolved