git.delta.rocks / unique-network / refs/commits / 534b0fa44c4b

difftreelog

feat add test pallets mechanism

Daniel Shiposha2022-08-18parent: #56c909e.patch.diff
in: master

14 files changed

modifiedCargo.lockdiffbeforeafterboth
5345 "pallet-structure",5345 "pallet-structure",
5346 "pallet-sudo",5346 "pallet-sudo",
5347 "pallet-template-transaction-payment",5347 "pallet-template-transaction-payment",
5348 "pallet-test-utils",
5348 "pallet-timestamp",5349 "pallet-timestamp",
5349 "pallet-transaction-payment",5350 "pallet-transaction-payment",
5350 "pallet-transaction-payment-rpc-runtime-api",5351 "pallet-transaction-payment-rpc-runtime-api",
6668 "up-sponsorship",6669 "up-sponsorship",
6669]6670]
6671
6672[[package]]
6673name = "pallet-test-utils"
6674version = "0.1.0"
6675dependencies = [
6676 "frame-support",
6677 "frame-system",
6678 "parity-scale-codec 3.1.5",
6679 "scale-info",
6680]
66706681
6671[[package]]6682[[package]]
6672name = "pallet-timestamp"6683name = "pallet-timestamp"
8793 "pallet-structure",8804 "pallet-structure",
8794 "pallet-sudo",8805 "pallet-sudo",
8795 "pallet-template-transaction-payment",8806 "pallet-template-transaction-payment",
8807 "pallet-test-utils",
8796 "pallet-timestamp",8808 "pallet-timestamp",
8797 "pallet-transaction-payment",8809 "pallet-transaction-payment",
8798 "pallet-transaction-payment-rpc-runtime-api",8810 "pallet-transaction-payment-rpc-runtime-api",
12866 "pallet-structure",12878 "pallet-structure",
12867 "pallet-sudo",12879 "pallet-sudo",
12868 "pallet-template-transaction-payment",12880 "pallet-template-transaction-payment",
12881 "pallet-test-utils",
12869 "pallet-timestamp",12882 "pallet-timestamp",
12870 "pallet-transaction-payment",12883 "pallet-transaction-payment",
12871 "pallet-transaction-payment-rpc-runtime-api",12884 "pallet-transaction-payment-rpc-runtime-api",
modifiedCargo.tomldiffbeforeafterboth

no syntactic changes

modifiednode/cli/Cargo.tomldiffbeforeafterboth
336 'opal-runtime?/try-runtime',336 'opal-runtime?/try-runtime',
337]337]
338
339test-pallets = [
340 'unique-runtime?/test-pallets',
341 'quartz-runtime?/test-pallets',
342]
338343
modifiedruntime/common/config/mod.rsdiffbeforeafterboth
22pub mod substrate;22pub mod substrate;
23pub mod xcm;23pub mod xcm;
24
25#[cfg(feature = "test-pallets")]
26pub mod test_pallets;
2427
addedruntime/common/config/test_pallets.rsdiffbeforeafterboth

no changes

modifiedruntime/common/construct_runtime/mod.rsdiffbeforeafterboth
94 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,94 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
95 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,95 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
96
97 #[test_pallets]
98 {
99 TestUtils: pallet_test_utils,
100 }
96 }101 }
97 }102 }
98 }103 }
modifiedruntime/common/construct_runtime/util.rsdiffbeforeafterboth
28 ),*28 ),*
29 $(,)?29 $(,)?
30
31 #[test_pallets]
32 {
33 $(
34 $test_pallet_name:ident: $test_pallet_mod:ident
35 ),*
36 $(,)?
37 }
30 }38 }
31 ) => {39 ) => {
32 $crate::construct_runtime_helper! {40 $crate::construct_runtime_helper! {
33 select_runtime($select_runtime),41 select_runtime($select_runtime),
34 selected_pallets(),42 selected_pallets(),
43 test_pallets(
44 $(
45 $test_pallet_name: $test_pallet_mod
46 ),*
47 ),
3548
36 where_clause($($where_ident = $where_ty),*),49 where_clause($($where_ident = $where_ty),*),
37 pallets(50 pallets(
49 (62 (
50 select_runtime($select_runtime:ident),63 select_runtime($select_runtime:ident),
51 selected_pallets($($selected_pallets:tt)*),64 selected_pallets($($selected_pallets:tt)*),
65 test_pallets($($test_pallets:tt)*),
5266
53 where_clause($($where_clause:tt)*),67 where_clause($($where_clause:tt)*),
54 pallets(68 pallets(
62 select_runtime($select_runtime),76 select_runtime($select_runtime),
63 runtimes($($pallet_runtimes),+,),77 runtimes($($pallet_runtimes),+,),
64 selected_pallets($($selected_pallets)*),78 selected_pallets($($selected_pallets)*),
79 test_pallets($($test_pallets)*),
6580
66 where_clause($($where_clause)*),81 where_clause($($where_clause)*),
67 pallets(82 pallets(
74 (89 (
75 select_runtime($select_runtime:ident),90 select_runtime($select_runtime:ident),
76 selected_pallets($($selected_pallets:tt)*),91 selected_pallets($($selected_pallets:tt)*),
92 test_pallets($($test_pallets:tt)*),
7793
78 where_clause($($where_clause:tt)*),94 where_clause($($where_clause:tt)*),
79 pallets(95 pallets(
88 $($selected_pallets)*104 $($selected_pallets)*
89 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,105 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,
90 ),106 ),
107 test_pallets($($test_pallets)*),
91108
92 where_clause($($where_clause)*),109 where_clause($($where_clause)*),
93 pallets($($pallets_tl)*)110 pallets($($pallets_tl)*)
97 (114 (
98 select_runtime($select_runtime:ident),115 select_runtime($select_runtime:ident),
99 selected_pallets($($selected_pallets:tt)*),116 selected_pallets($($selected_pallets:tt)*),
117 test_pallets($($test_pallets:tt)*),
100118
101 where_clause($($where_clause:tt)*),119 where_clause($($where_clause:tt)*),
102 pallets()120 pallets()
103 ) => {121 ) => {
122 #[cfg(not(feature = "test-pallets"))]
104 frame_support::construct_runtime! {123 frame_support::construct_runtime! {
105 pub enum Runtime where124 pub enum Runtime where
106 $($where_clause)*125 $($where_clause)*
109 }128 }
110 }129 }
130
131 #[cfg(feature = "test-pallets")]
132 frame_support::construct_runtime! {
133 pub enum Runtime where
134 $($where_clause)*
135 {
136 $($selected_pallets)*
137 $($test_pallets)*
138 }
139 }
111 };140 };
112}141}
113142
117 select_runtime(opal),146 select_runtime(opal),
118 runtimes(opal, $($_runtime_tl:tt)*),147 runtimes(opal, $($_runtime_tl:tt)*),
119 selected_pallets($($selected_pallets:tt)*),148 selected_pallets($($selected_pallets:tt)*),
149 test_pallets($($test_pallets:tt)*),
120150
121 where_clause($($where_clause:tt)*),151 where_clause($($where_clause:tt)*),
122 pallets(152 pallets(
130 $($selected_pallets)*160 $($selected_pallets)*
131 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,161 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,
132 ),162 ),
163 test_pallets($($test_pallets)*),
133164
134 where_clause($($where_clause)*),165 where_clause($($where_clause)*),
135 pallets($($pallets_tl)*)166 pallets($($pallets_tl)*)
140 select_runtime(quartz),171 select_runtime(quartz),
141 runtimes(quartz, $($_runtime_tl:tt)*),172 runtimes(quartz, $($_runtime_tl:tt)*),
142 selected_pallets($($selected_pallets:tt)*),173 selected_pallets($($selected_pallets:tt)*),
174 test_pallets($($test_pallets:tt)*),
143175
144 where_clause($($where_clause:tt)*),176 where_clause($($where_clause:tt)*),
145 pallets(177 pallets(
153 $($selected_pallets)*185 $($selected_pallets)*
154 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,186 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,
155 ),187 ),
188 test_pallets($($test_pallets)*),
156189
157 where_clause($($where_clause)*),190 where_clause($($where_clause)*),
158 pallets($($pallets_tl)*)191 pallets($($pallets_tl)*)
163 select_runtime(unique),196 select_runtime(unique),
164 runtimes(unique, $($_runtime_tl:tt)*),197 runtimes(unique, $($_runtime_tl:tt)*),
165 selected_pallets($($selected_pallets:tt)*),198 selected_pallets($($selected_pallets:tt)*),
199 test_pallets($($test_pallets:tt)*),
166200
167 where_clause($($where_clause:tt)*),201 where_clause($($where_clause:tt)*),
168 pallets(202 pallets(
176 $($selected_pallets)*210 $($selected_pallets)*
177 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,211 $pallet_name: $pallet_mod$(::{$($pallet_parts),*})? = $index,
178 ),212 ),
213 test_pallets($($test_pallets)*),
179214
180 where_clause($($where_clause)*),215 where_clause($($where_clause)*),
181 pallets($($pallets_tl)*)216 pallets($($pallets_tl)*)
186 select_runtime($select_runtime:ident),221 select_runtime($select_runtime:ident),
187 runtimes($_current_runtime:ident, $($runtime_tl:tt)*),222 runtimes($_current_runtime:ident, $($runtime_tl:tt)*),
188 selected_pallets($($selected_pallets:tt)*),223 selected_pallets($($selected_pallets:tt)*),
224 test_pallets($($test_pallets:tt)*),
189225
190 where_clause($($where_clause:tt)*),226 where_clause($($where_clause:tt)*),
191 pallets($($pallets:tt)*)227 pallets($($pallets:tt)*)
194 select_runtime($select_runtime),230 select_runtime($select_runtime),
195 runtimes($($runtime_tl)*),231 runtimes($($runtime_tl)*),
196 selected_pallets($($selected_pallets)*),232 selected_pallets($($selected_pallets)*),
233 test_pallets($($test_pallets)*),
197234
198 where_clause($($where_clause)*),235 where_clause($($where_clause)*),
199 pallets($($pallets)*)236 pallets($($pallets)*)
204 select_runtime($select_runtime:ident),241 select_runtime($select_runtime:ident),
205 runtimes(),242 runtimes(),
206 selected_pallets($($selected_pallets:tt)*),243 selected_pallets($($selected_pallets:tt)*),
244 test_pallets($($test_pallets:tt)*),
207245
208 where_clause($($where_clause:tt)*),246 where_clause($($where_clause:tt)*),
209 pallets(247 pallets(
214 $crate::construct_runtime_helper! {252 $crate::construct_runtime_helper! {
215 select_runtime($select_runtime),253 select_runtime($select_runtime),
216 selected_pallets($($selected_pallets)*),254 selected_pallets($($selected_pallets)*),
255 test_pallets($($test_pallets)*),
217256
218 where_clause($($where_clause)*),257 where_clause($($where_clause)*),
219 pallets($($pallets_tl)*)258 pallets($($pallets_tl)*)
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
168 "orml-traits/std",168 "orml-traits/std",
169 "pallet-foreign-assets/std",169 "pallet-foreign-assets/std",
170
171 'pallet-test-utils?/std',
170]172]
173test-pallets = ['pallet-test-utils']
171limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']174limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
172opal-runtime = ['refungible', 'rmrk', 'app-promotion', 'foreign-assets']175opal-runtime = ['refungible', 'rmrk', 'app-promotion', 'foreign-assets']
173176
494[dev-dependencies.logtest]497[dev-dependencies.logtest]
495version = "2.0.0"498version = "2.0.0"
499
500################################################################################
501# Test dependencies
502pallet-test-utils = { optional = true, default-features = false, path = "../../test-pallets/utils" }
503
496504
497################################################################################505################################################################################
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
166 "orml-traits/std",166 "orml-traits/std",
167 "pallet-foreign-assets/std",167 "pallet-foreign-assets/std",
168
169 'pallet-test-utils?/std',
168]170]
171test-pallets = ['pallet-test-utils']
169limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']172limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
170quartz-runtime = ['refungible']173quartz-runtime = ['refungible']
171174
499[dev-dependencies.logtest]502[dev-dependencies.logtest]
500version = "2.0.0"503version = "2.0.0"
504
505################################################################################
506# Test dependencies
507pallet-test-utils = { optional = true, default-features = false, path = "../../test-pallets/utils" }
501508
502################################################################################509################################################################################
503# Build Dependencies510# Build Dependencies
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
167 "orml-traits/std",167 "orml-traits/std",
168 "pallet-foreign-assets/std",168 "pallet-foreign-assets/std",
169
170 'pallet-test-utils?/std',
169]171]
172test-pallets = ['pallet-test-utils']
170limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']173limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
171unique-runtime = []174unique-runtime = []
172175
493[dev-dependencies.logtest]496[dev-dependencies.logtest]
494version = "2.0.0"497version = "2.0.0"
498
499################################################################################
500# Test dependencies
501pallet-test-utils = { optional = true, default-features = false, path = "../../test-pallets/utils" }
495502
496################################################################################503################################################################################
497# Build Dependencies504# Build Dependencies
addedtest-pallets/utils/Cargo.lockdiffbeforeafterboth

no changes

addedtest-pallets/utils/Cargo.tomldiffbeforeafterboth

no changes

addedtest-pallets/utils/src/lib.rsdiffbeforeafterboth

no changes

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
49 'xtokens',49 'xtokens',
50];50];
51
52const testPallets = [
53 'testutils',
54];
5155
52// Pallets that depend on consensus and governance configuration56// Pallets that depend on consensus and governance configuration
53const consensusPallets = [57const consensusPallets = [
87 expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets]);91 expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets]);
88 });92 });
93
94 itSub('Test pallets are present', async ({helper}) => {
95 expect(helper.fetchAllPalletNames()).to.contain.members([...testPallets]);
96 });
8997
90 itSub('Governance and consensus pallets are present', async ({helper}) => {98 itSub('Governance and consensus pallets are present', async ({helper}) => {
91 expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets]);99 expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets]);