Skip to content

Commit 65c6c5e

Browse files
authored
refactor: simplify e2e node tests (#2738)
* refactor: simpler e2e runtime tests style * fix: fmt & external error change * refactor: remove left over sandbox usage * refactor: simplify e2e node tests * fmt
1 parent 70d204e commit 65c6c5e

File tree

42 files changed

+110
-268
lines changed

Some content is hidden

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

42 files changed

+110
-268
lines changed

integration-tests/all-abi/events/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,7 @@ pub mod events {
447447
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
448448

449449
#[ink_e2e::test]
450-
async fn emits_foreign_event<Client: E2EBackend>(
451-
mut client: Client,
452-
) -> E2EResult<()> {
450+
async fn emits_foreign_event(mut client: Client) -> E2EResult<()> {
453451
// given
454452
let init_value = false;
455453
let mut constructor = EventsRef::new(init_value);
@@ -510,9 +508,7 @@ pub mod events {
510508
}
511509

512510
#[ink_e2e::test()]
513-
async fn emits_inline_anonymous_event<Client: E2EBackend>(
514-
mut client: Client,
515-
) -> E2EResult<()> {
511+
async fn emits_inline_anonymous_event(mut client: Client) -> E2EResult<()> {
516512
// given
517513
let init_value = false;
518514
let mut constructor = EventsRef::new(init_value);
@@ -597,9 +593,7 @@ pub mod events {
597593
}
598594

599595
#[ink_e2e::test]
600-
async fn emits_event_with_option_topic_some<Client: E2EBackend>(
601-
mut client: Client,
602-
) -> E2EResult<()> {
596+
async fn emits_event_with_option_topic_some(mut client: Client) -> E2EResult<()> {
603597
// given
604598
let init_value = false;
605599
let mut constructor = EventsRef::new(init_value);
@@ -672,9 +666,7 @@ pub mod events {
672666
}
673667

674668
#[ink_e2e::test]
675-
async fn emits_event_with_option_topic_none<Client: E2EBackend>(
676-
mut client: Client,
677-
) -> E2EResult<()> {
669+
async fn emits_event_with_option_topic_none(mut client: Client) -> E2EResult<()> {
678670
// given
679671
let init_value = false;
680672
let mut constructor = EventsRef::new(init_value);

integration-tests/internal/builtin-precompiles/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ mod builtin_precompiles {
4242
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
4343

4444
#[ink_e2e::test]
45-
async fn bn128_add_works<Client: E2EBackend>(
46-
mut client: Client,
47-
) -> E2EResult<()> {
45+
async fn bn128_add_works(mut client: Client) -> E2EResult<()> {
4846
// given
4947
let mut constructor = BuiltinPrecompilesRef::new();
5048
let contract = client
@@ -76,9 +74,7 @@ mod builtin_precompiles {
7674
}
7775

7876
#[ink_e2e::test]
79-
async fn bn128_mul_works<Client: E2EBackend>(
80-
mut client: Client,
81-
) -> E2EResult<()> {
77+
async fn bn128_mul_works(mut client: Client) -> E2EResult<()> {
8278
// given
8379
let mut constructor = BuiltinPrecompilesRef::new();
8480
let contract = client
@@ -110,9 +106,7 @@ mod builtin_precompiles {
110106
}
111107

112108
#[ink_e2e::test]
113-
async fn bn128_pairing_works<Client: E2EBackend>(
114-
mut client: Client,
115-
) -> E2EResult<()> {
109+
async fn bn128_pairing_works(mut client: Client) -> E2EResult<()> {
116110
// given
117111
let mut constructor = BuiltinPrecompilesRef::new();
118112
let contract = client
@@ -143,9 +137,7 @@ mod builtin_precompiles {
143137
}
144138

145139
#[ink_e2e::test]
146-
async fn bn128_pairing_zero_points_works<Client: E2EBackend>(
147-
mut client: Client,
148-
) -> E2EResult<()> {
140+
async fn bn128_pairing_zero_points_works(mut client: Client) -> E2EResult<()> {
149141
// given
150142
let mut constructor = BuiltinPrecompilesRef::new();
151143
let contract = client

integration-tests/internal/call-builder-return-value/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ mod call_builder {
121121
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
122122

123123
#[ink_e2e::test]
124-
async fn e2e_delegate_call_return_value_returns_correct_value<
125-
Client: E2EBackend,
126-
>(
124+
async fn e2e_delegate_call_return_value_returns_correct_value(
127125
mut client: Client,
128126
) -> E2EResult<()> {
129127
let origin = client
@@ -165,9 +163,7 @@ mod call_builder {
165163
}
166164

167165
#[ink_e2e::test]
168-
async fn e2e_delegate_call_return_value_errors_if_return_data_too_long<
169-
Client: E2EBackend,
170-
>(
166+
async fn e2e_delegate_call_return_value_errors_if_return_data_too_long(
171167
mut client: Client,
172168
) -> E2EResult<()> {
173169
let origin = client
@@ -209,9 +205,7 @@ mod call_builder {
209205
}
210206

211207
#[ink_e2e::test]
212-
async fn e2e_forward_call_return_value_returns_correct_value<
213-
Client: E2EBackend,
214-
>(
208+
async fn e2e_forward_call_return_value_returns_correct_value(
215209
mut client: Client,
216210
) -> E2EResult<()> {
217211
let origin = client
@@ -252,9 +246,7 @@ mod call_builder {
252246
}
253247

254248
#[ink_e2e::test]
255-
async fn e2e_forward_call_return_value_errors_if_return_data_too_long<
256-
Client: E2EBackend,
257-
>(
249+
async fn e2e_forward_call_return_value_errors_if_return_data_too_long(
258250
mut client: Client,
259251
) -> E2EResult<()> {
260252
let origin = client

integration-tests/internal/data-hostfns/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ mod data_hostfns {
3333
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
3434

3535
#[ink_e2e::test]
36-
async fn e2e_call_data_size_works<Client: E2EBackend>(
37-
mut client: Client,
38-
) -> E2EResult<()> {
36+
async fn e2e_call_data_size_works(mut client: Client) -> E2EResult<()> {
3937
// given
4038
let contract = client
4139
.instantiate(
@@ -63,9 +61,7 @@ mod data_hostfns {
6361
}
6462

6563
#[ink_e2e::test]
66-
async fn e2e_return_data_size_works<Client: E2EBackend>(
67-
mut client: Client,
68-
) -> E2EResult<()> {
64+
async fn e2e_return_data_size_works(mut client: Client) -> E2EResult<()> {
6965
// given
7066
let contract = client
7167
.instantiate(

integration-tests/internal/gas-hostfns/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ mod gas_hostfns {
3939
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
4040

4141
#[ink_e2e::test]
42-
async fn e2e_gas_limit_works<Client: E2EBackend>(
43-
mut client: Client,
44-
) -> E2EResult<()> {
42+
async fn e2e_gas_limit_works(mut client: Client) -> E2EResult<()> {
4543
// given
4644
let contract = client
4745
.instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new())
@@ -65,9 +63,7 @@ mod gas_hostfns {
6563
}
6664

6765
#[ink_e2e::test]
68-
async fn e2e_gas_price_works<Client: E2EBackend>(
69-
mut client: Client,
70-
) -> E2EResult<()> {
66+
async fn e2e_gas_price_works(mut client: Client) -> E2EResult<()> {
7167
// given
7268
let contract = client
7369
.instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new())
@@ -91,9 +87,7 @@ mod gas_hostfns {
9187
}
9288

9389
#[ink_e2e::test]
94-
async fn e2e_gas_left_works<Client: E2EBackend>(
95-
mut client: Client,
96-
) -> E2EResult<()> {
90+
async fn e2e_gas_left_works(mut client: Client) -> E2EResult<()> {
9791
// given
9892
let contract = client
9993
.instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new())

integration-tests/internal/lang-err/call-builder-delegate/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ mod call_builder {
102102
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
103103

104104
#[ink_e2e::test]
105-
async fn e2e_invalid_message_selector_can_be_handled<Client: E2EBackend>(
105+
async fn e2e_invalid_message_selector_can_be_handled(
106106
mut client: Client,
107107
) -> E2EResult<()> {
108108
let origin = client
@@ -142,7 +142,7 @@ mod call_builder {
142142
}
143143

144144
#[ink_e2e::test]
145-
async fn e2e_invalid_message_selector_panics_on_invoke<Client: E2EBackend>(
145+
async fn e2e_invalid_message_selector_panics_on_invoke(
146146
mut client: Client,
147147
) -> E2EResult<()> {
148148
let origin = client

integration-tests/internal/lang-err/call-builder/lib.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ mod call_builder {
176176
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
177177

178178
#[ink_e2e::test]
179-
async fn e2e_invalid_message_selector_can_be_handled<Client: E2EBackend>(
179+
async fn e2e_invalid_message_selector_can_be_handled(
180180
mut client: Client,
181181
) -> E2EResult<()> {
182182
let origin = client
@@ -227,7 +227,7 @@ mod call_builder {
227227
}
228228

229229
#[ink_e2e::test]
230-
async fn e2e_invalid_message_selector_panics_on_invoke<Client: E2EBackend>(
230+
async fn e2e_invalid_message_selector_panics_on_invoke(
231231
mut client: Client,
232232
) -> E2EResult<()> {
233233
let mut constructor = CallBuilderTestRef::new();
@@ -264,7 +264,7 @@ mod call_builder {
264264
}
265265

266266
#[ink_e2e::test]
267-
async fn e2e_create_builder_works_with_valid_selector<Client: E2EBackend>(
267+
async fn e2e_create_builder_works_with_valid_selector(
268268
mut client: Client,
269269
) -> E2EResult<()> {
270270
let origin = client
@@ -305,7 +305,7 @@ mod call_builder {
305305
}
306306

307307
#[ink_e2e::test]
308-
async fn e2e_create_builder_fails_with_invalid_selector<Client: E2EBackend>(
308+
async fn e2e_create_builder_fails_with_invalid_selector(
309309
mut client: Client,
310310
) -> E2EResult<()> {
311311
let origin = client
@@ -346,9 +346,7 @@ mod call_builder {
346346
}
347347

348348
#[ink_e2e::test]
349-
async fn e2e_create_builder_with_infallible_revert_constructor_encodes_ok<
350-
Client: E2EBackend,
351-
>(
349+
async fn e2e_create_builder_with_infallible_revert_constructor_encodes_ok(
352350
mut client: Client,
353351
) -> E2EResult<()> {
354352
let origin = client
@@ -385,9 +383,7 @@ mod call_builder {
385383
}
386384

387385
#[ink_e2e::test]
388-
async fn e2e_create_builder_can_handle_fallible_constructor_success<
389-
Client: E2EBackend,
390-
>(
386+
async fn e2e_create_builder_can_handle_fallible_constructor_success(
391387
mut client: Client,
392388
) -> E2EResult<()> {
393389
let origin = client
@@ -429,9 +425,7 @@ mod call_builder {
429425
}
430426

431427
#[ink_e2e::test]
432-
async fn e2e_create_builder_can_handle_fallible_constructor_error<
433-
Client: E2EBackend,
434-
>(
428+
async fn e2e_create_builder_can_handle_fallible_constructor_error(
435429
mut client: Client,
436430
) -> E2EResult<()> {
437431
let origin = client
@@ -480,9 +474,7 @@ mod call_builder {
480474
}
481475

482476
#[ink_e2e::test]
483-
async fn e2e_create_builder_with_fallible_revert_constructor_encodes_ok<
484-
Client: E2EBackend,
485-
>(
477+
async fn e2e_create_builder_with_fallible_revert_constructor_encodes_ok(
486478
mut client: Client,
487479
) -> E2EResult<()> {
488480
let origin = client
@@ -519,9 +511,7 @@ mod call_builder {
519511
}
520512

521513
#[ink_e2e::test]
522-
async fn e2e_create_builder_with_fallible_revert_constructor_encodes_err<
523-
Client: E2EBackend,
524-
>(
514+
async fn e2e_create_builder_with_fallible_revert_constructor_encodes_err(
525515
mut client: Client,
526516
) -> E2EResult<()> {
527517
let origin = client

integration-tests/internal/lang-err/constructors-return-value/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ pub mod constructors_return_value {
116116
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
117117

118118
#[ink_e2e::test]
119-
async fn e2e_infallible_constructor<Client: E2EBackend>(
120-
mut client: Client,
121-
) -> E2EResult<()> {
119+
async fn e2e_infallible_constructor(mut client: Client) -> E2EResult<()> {
122120
let mut constructor = ConstructorsReturnValueRef::new(true);
123121
let infallible_constructor_result = client
124122
.instantiate(
@@ -154,9 +152,7 @@ pub mod constructors_return_value {
154152
}
155153

156154
#[ink_e2e::test]
157-
async fn e2e_fallible_constructor_succeed<Client: E2EBackend>(
158-
mut client: Client,
159-
) -> E2EResult<()> {
155+
async fn e2e_fallible_constructor_succeed(mut client: Client) -> E2EResult<()> {
160156
let mut constructor = ConstructorsReturnValueRef::try_new(true);
161157
let result = client
162158
.instantiate(
@@ -205,9 +201,7 @@ pub mod constructors_return_value {
205201
}
206202

207203
#[ink_e2e::test]
208-
async fn e2e_fallible_constructor_fails<Client: E2EBackend>(
209-
mut client: Client,
210-
) -> E2EResult<()> {
204+
async fn e2e_fallible_constructor_fails(mut client: Client) -> E2EResult<()> {
211205
let mut constructor = ConstructorsReturnValueRef::try_new(false);
212206

213207
let result = client

integration-tests/internal/lang-err/contract-ref/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ mod contract_ref {
8282
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
8383

8484
#[ink_e2e::test]
85-
async fn e2e_ref_can_flip_correctly<Client: E2EBackend>(
86-
mut client: Client,
87-
) -> E2EResult<()> {
85+
async fn e2e_ref_can_flip_correctly(mut client: Client) -> E2EResult<()> {
8886
let flipper_hash = client
8987
.upload("integration_flipper", &ink_e2e::alice())
9088
.submit()
@@ -126,7 +124,7 @@ mod contract_ref {
126124
}
127125

128126
#[ink_e2e::test]
129-
async fn e2e_fallible_ref_can_be_instantiated<Client: E2EBackend>(
127+
async fn e2e_fallible_ref_can_be_instantiated(
130128
mut client: Client,
131129
) -> E2EResult<()> {
132130
let flipper_hash: ink::H256 = client
@@ -156,7 +154,7 @@ mod contract_ref {
156154
}
157155

158156
#[ink_e2e::test]
159-
async fn e2e_fallible_ref_fails_to_be_instantiated<Client: E2EBackend>(
157+
async fn e2e_fallible_ref_fails_to_be_instantiated(
160158
mut client: Client,
161159
) -> E2EResult<()> {
162160
let flipper_hash = client

integration-tests/internal/lang-err/integration-flipper/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ pub mod integration_flipper {
6767
type E2EResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
6868

6969
#[ink_e2e::test]
70-
async fn e2e_can_flip_correctly<Client: E2EBackend>(
71-
mut client: Client,
72-
) -> E2EResult<()> {
70+
async fn e2e_can_flip_correctly(mut client: Client) -> E2EResult<()> {
7371
let mut constructor = FlipperRef::new_default();
7472
let flipper = client
7573
.instantiate("integration_flipper", &ink_e2e::alice(), &mut constructor)
@@ -107,9 +105,7 @@ pub mod integration_flipper {
107105
}
108106

109107
#[ink_e2e::test]
110-
async fn e2e_message_error_reverts_state<Client: E2EBackend>(
111-
mut client: Client,
112-
) -> E2EResult<()> {
108+
async fn e2e_message_error_reverts_state(mut client: Client) -> E2EResult<()> {
113109
let mut constructor = FlipperRef::new_default();
114110
let flipper = client
115111
.instantiate("integration_flipper", &ink_e2e::bob(), &mut constructor)

0 commit comments

Comments
 (0)