Unittests will retry provisioning if failed.

[ Merge of http://go/wvgerrit/84490 ]

The unit tests will now make at most 10 attempts to provision
themselves before declaring failure.

This change is made to help with flaky provisioning requests that
have been experienced on the Jenkins build server.

Bug: 139298083
Test: Linux unit test, Jenkins build and Android unit tests
Change-Id: I6415a5ef9fdf10ceb893867d5fc73131338e9f76
This commit is contained in:
Alex Dale
2019-08-13 18:13:35 -07:00
parent e884b06e54
commit 8a82379e81
2 changed files with 82 additions and 31 deletions

View File

@@ -19,6 +19,9 @@ namespace wvcdm {
// to configure OEMCrypto to use a test keybox.
class WvCdmTestBase : public ::testing::Test {
public:
// Default number of provisioning try attempts.
constexpr static size_t kDefaultMaxProvisioningAttempts = 10;
WvCdmTestBase() : config_(default_config_), binary_provisioning_(false) {}
~WvCdmTestBase() override {}
void SetUp() override;
@@ -32,7 +35,7 @@ class WvCdmTestBase : public ::testing::Test {
static void InstallTestRootOfTrust();
// Send provisioning request to the server and handle response.
virtual void Provision();
virtual void Provision(size_t max_attempts = kDefaultMaxProvisioningAttempts);
// Calls Provision() if not already provisioned.
virtual void EnsureProvisioned();