Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the HW/FW being more advanced, we need to support different parameters for the integration tests - for example FIPS approved devices need to use different (complex) PINs, sessions need to be opened with specific SCP parameters and similar.
We kept such information in static variables (for example PivTestState.DEFAULT_MANAGEMENT_KEY) which were initialized by a static method (for example PivTestUtils.verifyAndSetup(device)). This approach is not scalable and this PR introduces a TestState class which holds the test related information and is passed into the testing methods.
The class has subclasses for each application (where applicable) which setup and verify the state based on the connected device.
The
TestState
class holds the following properties:YubikeyDevice currentDevice
- the device which the integration tests is usingScpParameters scpParameters
- SCP related data (keys, kid)ReconnectDeviceCallback reconnectCallback
- callback which will cause a reconnection of a device, provided by the platform (currently Android only) codeboolean isUsbTransport
- helper to get the transport flagThe
TestState
class also provides helper for its sub classes which can be used to open connections and get different sessions.The subclasses contain specific properties which can be used during a test session. These properties are initialized in the constructor. Currently there are following properties
PivTestState
:isFipsApproved
,defaultPin
,defaultPuk
,defaultManagementKey
OathTestState
:isFipsApproved
,password
OpenPgpTestState
:isFipsApproved
,defaultUserPin
,defaultAdminPin
MpeTestState
: noneThe platform test framework can execute two types of tests: session specific or device specific. The device specific tests can be used to process information which is not part of the session and also run several session tests during one tests - after each test, the reconnect callback is used to artificially reconnect the device (see
OathDeviceTests.changePassword
which changes the OATH password in one session and verifies it directly in another).As part of this PR also the following tests has been updated to use the TestState approach: MultiProtocolReset, PinComplexity and Oath.
To write new integration tests, the only difference is that they should have a second parameter holding the state.