@@ -9,14 +9,12 @@ use serde::de::DeserializeOwned;
9
9
use fil_actor_market:: {
10
10
Actor as MarketActor , DealQueryParams , GetDealActivationReturn , GetDealClientCollateralReturn ,
11
11
GetDealClientReturn , GetDealDataCommitmentReturn , GetDealLabelReturn ,
12
- GetDealProviderCollateralReturn , GetDealProviderReturn , GetDealTermReturn ,
13
- GetDealTotalPriceReturn , GetDealVerifiedReturn , Method , EX_DEAL_EXPIRED ,
12
+ GetDealProviderCollateralReturn , GetDealProviderReturn , GetDealSectorReturn , GetDealTermReturn ,
13
+ GetDealTotalPriceReturn , GetDealVerifiedReturn , Method , EX_DEAL_EXPIRED , EX_DEAL_NOT_ACTIVATED ,
14
14
} ;
15
15
use fil_actors_runtime:: network:: EPOCHS_IN_DAY ;
16
16
use fil_actors_runtime:: runtime:: policy_constants:: DEAL_UPDATES_INTERVAL ;
17
- use fil_actors_runtime:: test_utils:: {
18
- expect_abort_contains_message, MockRuntime , ACCOUNT_ACTOR_CODE_ID ,
19
- } ;
17
+ use fil_actors_runtime:: test_utils:: { expect_abort, MockRuntime , ACCOUNT_ACTOR_CODE_ID } ;
20
18
use fil_actors_runtime:: ActorError ;
21
19
use fil_actors_runtime:: BURNT_FUNDS_ACTOR_ADDR ;
22
20
use harness:: * ;
@@ -114,6 +112,7 @@ fn activation() {
114
112
query_deal ( & rt, Method :: GetDealActivationExported , id) ;
115
113
assert_eq ! ( EPOCH_UNDEFINED , activation. activated) ;
116
114
assert_eq ! ( EPOCH_UNDEFINED , activation. terminated) ;
115
+ query_deal_fails ( & rt, Method :: GetDealSectorExported , id, EX_DEAL_NOT_ACTIVATED ) ;
117
116
118
117
// activate the deal
119
118
let activate_epoch = start_epoch - 2 ;
@@ -124,6 +123,10 @@ fn activation() {
124
123
query_deal ( & rt, Method :: GetDealActivationExported , id) ;
125
124
assert_eq ! ( activate_epoch, activation. activated) ;
126
125
assert_eq ! ( EPOCH_UNDEFINED , activation. terminated) ;
126
+ assert_eq ! (
127
+ GetDealSectorReturn { sector: sector_number } ,
128
+ query_deal( & rt, Method :: GetDealSectorExported , id)
129
+ ) ;
127
130
128
131
// terminate early
129
132
let terminate_epoch = activate_epoch + 100 ;
@@ -133,6 +136,7 @@ fn activation() {
133
136
query_deal ( & rt, Method :: GetDealActivationExported , id) ;
134
137
assert_eq ! ( activate_epoch, activation. activated) ;
135
138
assert_eq ! ( terminate_epoch, activation. terminated) ;
139
+ query_deal_fails ( & rt, Method :: GetDealSectorExported , id, EX_DEAL_EXPIRED ) ;
136
140
137
141
// Clean up state
138
142
let clean_epoch = terminate_epoch + DEAL_UPDATES_INTERVAL ;
@@ -146,24 +150,22 @@ fn activation() {
146
150
ExitCode :: OK ,
147
151
) ;
148
152
cron_tick ( & rt) ;
149
- expect_abort_contains_message (
150
- EX_DEAL_EXPIRED ,
151
- "expired" ,
152
- query_deal_raw ( & rt, Method :: GetDealActivationExported , id) ,
153
- ) ;
153
+ query_deal_fails ( & rt, Method :: GetDealActivationExported , id, EX_DEAL_EXPIRED ) ;
154
+ query_deal_fails ( & rt, Method :: GetDealSectorExported , id, EX_DEAL_EXPIRED ) ;
154
155
155
- // Non-existent deal is NOT FOUND
156
- expect_abort_contains_message (
157
- ExitCode :: USR_NOT_FOUND ,
158
- "no such deal" ,
159
- query_deal_raw ( & rt, Method :: GetDealActivationExported , id + 1 ) ,
160
- ) ;
156
+ // Non-existent deal is USR_NOT_FOUND
157
+ query_deal_fails ( & rt, Method :: GetDealActivationExported , id + 1 , ExitCode :: USR_NOT_FOUND ) ;
158
+ query_deal_fails ( & rt, Method :: GetDealSectorExported , id + 1 , ExitCode :: USR_NOT_FOUND ) ;
161
159
}
162
160
163
161
fn query_deal < T : DeserializeOwned > ( rt : & MockRuntime , method : Method , id : u64 ) -> T {
164
162
query_deal_raw ( rt, method, id) . unwrap ( ) . unwrap ( ) . deserialize ( ) . unwrap ( )
165
163
}
166
164
165
+ fn query_deal_fails ( rt : & MockRuntime , method : Method , id : u64 , expected : ExitCode ) {
166
+ expect_abort ( expected, query_deal_raw ( rt, method, id) ) ;
167
+ }
168
+
167
169
fn query_deal_raw (
168
170
rt : & MockRuntime ,
169
171
method : Method ,
0 commit comments