Skip to content

Rework test config design #477

@rockbmb

Description

@rockbmb

Test configuration types:

/**
* Configuration for relay chain tests.
*/
export interface RelayTestConfig {
testSuiteName: string
addressEncoding: number
blockProvider: 'Local'
chainEd?: ChainED
}
/**
* Configuration for parachain tests.
* Async backing is relevant due to the step size of `parachainSystem.lastRelayChainBlockNumber`.
*
* Recall that with the AHM, the scheduler pallet's agenda will be keyed by this block number.
* It is, then, relevant for tests to know whether AB is enabled.
*/
export interface ParaTestConfig {
testSuiteName: string
addressEncoding: number
blockProvider: BlockProvider
asyncBacking: AsyncBacking
chainEd?: ChainED
}
/**
* Union type for all test configurations, whether relay or parachain.
*/
export type TestConfig = RelayTestConfig | ParaTestConfig

were originally meant to facilitate the specification of network-specific information such as a test suite name and the network's SS58 address encoding, to be used in tests when comparing addresses in events and data queries.

However, this is repetitive, brittle and at times hindering and unexpressive:

const testConfigForAssetHub: ParaTestConfig = {
testSuiteName: 'Kusama People System',
addressEncoding: 2,
blockProvider: 'NonLocal',
asyncBacking: 'Enabled',
}
registerTestTree(systemE2ETestsViaRemoteScheduler(assetHubKusama, peopleKusama, testConfigForAssetHub))

const testConfigForAssetHub: ParaTestConfig = {
testSuiteName: 'Polkadot System',
addressEncoding: 2,
blockProvider: 'NonLocal',
asyncBacking: 'Enabled',
}
registerTestTree(systemE2ETestsViaRemoteScheduler(assetHubPolkadot, polkadot, testConfigForAssetHub))

const testConfigForAssetHub: ParaTestConfig = {
testSuiteName: 'Polkadot BridgeHub System',
addressEncoding: 0,
blockProvider: 'NonLocal',
asyncBacking: 'Enabled',
}
registerTestTree(systemE2ETestsViaRemoteScheduler(assetHubPolkadot, bridgeHubPolkadot, testConfigForAssetHub))

Consider the last 3 examples, introduced as part of #411. These system suites, which test runtime upgrades, have configuration data related to the network's asset hub chain, but also:

  • the network's address encoding
  • whether or not the tested chain's block provider is local
  • whether or not AB is enabled
  • the test suite's name

The configuration's semantic value is confusing: from the above data, some is related to the chain being tested, other to the network's AH, some is metadata (suite name).

This issue is about improving this situation.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions